I m trying to build a code to get position of the smartphone from a private SDK. So i m build this code:
nextomePhoenixSdk.getLocalizationLiveData().observe((LifecycleOwner) myActivity, new androidx.lifecycle.Observer(){
public void onChanged(Object var1) {
this.onChanged((NextomePosition)var1);
}
public final void onChanged(NextomePosition it) {
Log.e("POSITION FROM NEXTOME", "X: " + it.getX() + " Y: " + it.getY());
}
});
Now if I try to start the application and I have myActivity as current View the new position will be notified by onChanged method.
But if I try to set in background my application or simply I try to change activity, the observer end to notify me new position though the service continue to run. Now I want to find a view to get new position every time also if the app is in background mode or if the user change the activity. How can I do this?