Skip to content Skip to sidebar Skip to footer

Little Fluffy Location Library Can't Find Location

My Goal is to have a service that runs in the background and sends my device's location to a remote server at a specified interval (eg. every 10 minutes). I am trying to use Little

Solution 1:

I don't know you already found the issue. I feel the issue is in your Manifest file.

<serviceandroid:name="com.littlefluffytoys.littlefluffylocationlibrary.LocationBroadcastService" /><receiverandroid:name="com.littlefluffytoys.littlefluffylocationlibrary.PassiveLocationChangedReceiver"android:exported="true" />

Then your receiver should have this,

<receiverandroid:name="com.testtracker.MyBroadcastReceiver">  
<intent-filter><actionandroid:name="com.testtracker.littlefluffylocationlibrary.LOCATION_CHANGED" /></intent-filter></receiver>

Also, in the receiver you are getting the LocationInfo object, I feel the better approach is start your service from receiver, and pass the LocationInfo as extras to the intent.

Intent service = newIntent(context, MyService.class);
service.putExtra(LocationLibraryConstants.LOCATION_BROADCAST_EXTRA_LOCATIONINFO, locationInfo);

Then from the LocationInfo, get the latitude and longitude from your service.

finalLocationInfolocationInfo= (LocationInfo) intent.getSerializableExtra(LocationLibraryConstants.LOCATION_BROADCAST_EXTRA_LOCATIONINFO);
if (locationInfo != null) {
   floatlat= locationInfo.lastLat;
   floatlng= locationInfo.lastLong;
}

Hope somebody uses this library can get help from this.

Post a Comment for "Little Fluffy Location Library Can't Find Location"