Location Tracking

Add at least one of the following the following permission to your AndroidManifest.xml file to declare your app’s intent to collect location data:

1
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Or:

1
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

ACCESS_FINE_LOCATION includes GPS data in reporting user location while ACCESS_COARSE_LOCATION includes data from the most battery-efficient non-GPS provider available (e.g. the network). Coarse location location will likely be sufficient for the majority of location data use-cases; however, under the runtime permissions model, receiving location permission from the user implicitly authorizes the collection of fine location data. You can read more about the differences between these location permissions and how you ought to utilize them here.

Disabling Automatic Location Tracking

To disable automatic location tracking, set com_appboy_enable_location_collection to false in appboy.xml:

1
<bool name="com_appboy_enable_location_collection">false</bool>

Then you can manually log single location data points via the setLastKnownLocation() method on AppboyUser like this:

1
Appboy.getInstance(context).getCurrentUser().setLastKnownLocation(LATITUDE_DOUBLE_VALUE, LONGITUDE_DOUBLE_VALUE, ALTITUDE_DOUBLE_VALUE, ACCURACY_DOUBLE_VALUE);

See here in our Javadocs for more information on the setLastKnownLocation method.

WAS THIS PAGE HELPFUL?
New Stuff!