yayaa / LocationManager

Simplify getting user's location for Android
806 stars 187 forks source link

How get location when app close or not active? #39

Closed no-cat-no closed 7 years ago

no-cat-no commented 7 years ago

I'm using BroadcastReceiver (see: SampleService). However, when the application is closed or inactive (enabled, but running in the background), the coordinates are not determined. I tried to comment out the line with unregisterReceiver, but it did not help.

@Override
protected void onPause() {
    super.onPause();
//    unregisterReceiver(broadcastReceiver);
}
yayaa commented 7 years ago

Hey, @no-cat-no that is an implementation detail, not an issue of this library.

If your app needs to behave even it's on background, then you might need to consider re-launching or implementing your own login within the service instead of using broadcast receiver to notify some part of the application.

no-cat-no commented 7 years ago

I'm sorry, you're right. I'm not a very good programmer, so many questions.