Android gps programmatically turning on and turning off

前端 未结 3 1206
后悔当初
后悔当初 2020-12-30 18:05

i have written a simple gps code , which is turning on and turning off the gps programmatically in some device(say moto g) but some older version or Samsung duos and some o

3条回答
  •  無奈伤痛
    2020-12-30 18:49

    First of all it depends if you catch the geolocation by Google Play Services or if you do it the "old" way. I would not suggest to do something behind the user. A common way is to check if the GPS is on and at best direct the user to the system settings by using a PreferenceScreen. Also inform the user with a DialogPreference or a toast. Otherwise if you want to do it the dirty way, you can find an answer on Stackoverflow

提交回复
热议问题