安卓GPS位置更新时,手机处于睡眠? [英] Android: GPS location updates when the cellphone is in sleep?

查看:286
本文介绍了安卓GPS位置更新时,手机处于睡眠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在后台更新通过GPS的位置,即使手机处于睡眠。我想用AlarmManager广播的意图,然后接收器将调用requestLocationUpdates()上的LocationManager。但我不知道是否它保证,当手机处于睡眠状态,如果我注册了一个的PendingIntent通知就会被广播的GPS位置将被更新时,调用requestLocationUpdates()?

I need to update the location through GPS in the background even when the phone is in sleep. I am thinking to use AlarmManager to broadcast an Intent and then a receiver will call requestLocationUpdates() on LocationManager. But I am not sure whether it's guaranteed that the GPS location will be updated when the phone is in sleep and an intent will be broadcasted if I registered a PendingIntent when call requestLocationUpdates()?

感谢,

推荐答案

当屏幕关闭GPS不工作!你可以为你的应用程序设置报警,但要获得GPS位置,你必须在屏幕上。

GPS aren't working when screen is off! You may set alarm for you app, but to get GPS position you must make screen on.

这篇关于安卓GPS位置更新时,手机处于睡眠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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