How do I find out if the GPS of an Android device is enabled

后端 未结 10 1730
暖寄归人
暖寄归人 2020-11-22 08:36

On an Android Cupcake (1.5) enabled device, how do I check and activate the GPS?

10条回答
  •  深忆病人
    2020-11-22 08:56

    GPS will be used if the user has allowed it to be used in its settings.

    You can't explicitly switch this on anymore, but you don't have to - it's a privacy setting really, so you don't want to tweak it. If the user is OK with apps getting precise co-ordinates it'll be on. Then the location manager API will use GPS if it can.

    If your app really isn't useful without GPS, and it's off, you can open the settings app at the right screen using an intent so the user can enable it.

提交回复
热议问题