In many cases it’s important to log the location of a user and associate that location with other events. The mParticle SDK allows you to include detailed location information with all of your events.
There are two ways to approach location tracking:
enableLocationTrackingmethod and let the mParticle SDK collect and update location information for you. Remember to call
disableLocationTrackingwhen you no longer need to track location
locationproperty directly. In this case you are responsible for maintaining
locationupdated and setting it to
nil/nullwhen no longer needed
// Specify a provider and minimum time (milliseconds) and minimum distance (meters) between location updates. MParticle.getInstance().enableLocationTracking(LocationManager.NETWORK_PROVIDER, 30*1000, 100); //alternatively, an application can manage it's own location updates //and manually set an android.location.Location object MParticle.getInstance().setLocation(someLocation);
See the Android developer guidelines for more info on available providers and the permissions that are required.