Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play Service Activity Recognition not working after switching Location mode to GPS and back

Our app is facing a strange problem after Google Play services updated to 4.1. We are using Activity Recognition in the Google Play services. If user changes Location mode to Device Only and back to Battery saving, Activity Recognition Client will stop giving activity updates. We tried to stop and re-request for updates, but it doesn't work. Only solution we found to make it work again is to restart phone.

Steps to reproduce:

  1. Download and run Activity Recognition Sample program from Android developer site.
  2. Open system settings -> Location -> Mode, Change mode to Device Only. Change it back to Battery Savings. A Location consent popup will appear, press Agree.
  3. Go back to your sample program and you can notice that app is not getting any activity updates.
  4. Stop updates, close and open app again, nothing works until phone is restarted.

We have tested same scenario in Google Play Services 4.2 release. Issue persists in 4.2 too.

In phones older than KitKat, same issue can be reproduced by turning off "Use Wireless networks" and turning back on again under Location services.

Any suggestions to pass this hurdle will be appreciated.

like image 924
Passionate Androiden Avatar asked Oct 02 '22 16:10

Passionate Androiden


1 Answers

This issue is fixed in latest update of Google Play services(4.3.23 (1069729-030)). All we need to do is replace library project "google-play-services_lib" with latest version(4.3.23 (1069729-030)). I noticed a delay of about 1 minute in AR updates if we toggle location settings, but it works.

like image 59
Passionate Androiden Avatar answered Oct 11 '22 18:10

Passionate Androiden