在我的应用程序中使用Android默认GPS开 - 关对话框 [英] Use the Android Default GPS ON-OFF dialog in My application

查看:182
本文介绍了在我的应用程序中使用Android默认GPS开 - 关对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序中,我们要整合android默认GPS对话框。当GPS关闭并且我们在谷歌地图应用程序中按下我的位置按钮时出现的对话框。还附加了我想要集成的对话框的图像。


  1. 点击否选项将关闭对话框。
  2. >
  3. 点击是选项将直接激活设备的GPS。

对话框出现在OLA app下面(ANDROID L):



对话框出现在OLA应用下面(ANDROID KIT_KAT):



出现在Google Map下面的对话框(ANDROID L):


我们现有的实现是当GPS关闭时,我们正在重定向应用程序到他/她可以打开位置的设备的默认位置设置屏幕。



期待找到答案。
提前致谢。

解决方案

您需要使用最新版本的Google Play服务。最新版本有一个对话框来激活所有需要的东西来获取GPS。



从Android Developer Play Service文档中,

< blockquote>

位置设置 - 虽然FusedLocationProviderApi结合了多个传感器来为您提供最佳位置,但应用程序接收位置的准确性仍然主要取决于设备上启用的设置(GPS,wifi,飞行模式, 和别的)。使用新的SettingsApi类,您可以调出一个位置设置对话框,该对话框显示一键控制,用户无需离开您的应用即可更改设置。


链接指向Play服务版本文档。 7.0版引入了这个新提示。


In Our application we want to integrate the android Default GPS Dialog. The same dialog that appears when the GPS is OFF and we press of my location button in google map apps. Have also attached the image of the dialog which I want to integrate.

  1. Clicking on "No" option will close the dialog.
  2. Clicking on "Yes" option will Activate the GPS of device directly.

Dialog the appears for OLA app Below (ANDROID L):

Dialog the appears for OLA app Below (ANDROID KIT_KAT):

Dialog the appears for Google Map Below (ANDROID L):

Our existing implementation is when the GPS is OFF we are redirecting application to the default location setting screen of the device from where he/she can turn ON the Location.

looking forward for answers. Thanks in advance.

解决方案

You need to use the latest version of Google Play service. latest version has one dialog to activate all required things to get the GPS.

From Android Developer Play Service documentation,

Location settings - While the FusedLocationProviderApi combines multiple sensors to give you the optimal location, the accuracy of the location your app receives still depends greatly on the settings enabled on the device (GPS, wifi, airplane mode, and others). Using the new SettingsApi class, you can bring up a Location Settings dialog which displays a one-touch control for users to change their settings without leaving your app.

Link directs to Play Service version documentation. Version 7.0 has introduced this new prompt.

这篇关于在我的应用程序中使用Android默认GPS开 - 关对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆