android待机后后台service工作异常

说谎的匹诺曹 2011-04-16 11:50:07
android待机后后台service工作异常

小弟我用service做了一个后台定时发送基站信息到服务器实现基站定位的程序,不待机的情况下使用
"GsmCellLocation gcl = (GsmCellLocation) telephonyManager.getCellLocation();
gcl.getCid();"的方法是可以获取到cellid的,程序正常,进入待机模式后程序还是一直运行,但是"gcl.getCid"返回值为"null";
我的测试机器是G7 android2.2的系统,是不是系统进入休眠状态了就无法获取了,如何解决这个问题呢?

请各位兄弟们帮帮忙啊!!
...全文
676 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
说谎的匹诺曹 2011-05-03
  • 打赏
  • 举报
回复
问题还是没有解决啊,求助啊!
说谎的匹诺曹 2011-04-22
  • 打赏
  • 举报
回复
问题还是没有解决啊,求助啊!
说谎的匹诺曹 2011-04-20
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 jalu_515 的回复:]

Indicates the current state of the screen. When the screen is off, the
* RIL should notify the baseband to suppress certain notifications (eg,
* signal strength and changes in LAC or CID) in an ……
[/Quote]
2.2之前的版本是可以的,我在真机上测试过
说谎的匹诺曹 2011-04-19
  • 打赏
  • 举报
回复
谢谢楼上的兄弟了,

可惜问题还是没有解决啊
山娃马小三儿 2011-04-19
  • 打赏
  • 举报
回复
Indicates the current state of the screen. When the screen is off, the
* RIL should notify the baseband to suppress certain notifications (eg,
* signal strength and changes in LAC or CID) in an effort to conserve power.
* These notifications should resume when the screen is on.

无法修复的问题,除非改底层,这个事件是在screen off的时候触发的,不是待机的时候,你咋让他不休眠都没用,除非让他屏幕常亮,但是太费电了
说谎的匹诺曹 2011-04-18
  • 打赏
  • 举报
回复
问题还是没有解决啊,自己顶一个
sky123123 2011-04-18
  • 打赏
  • 举报
回复
咋会出现这档子事儿呢 还米牛遇到过嘞、 帮顶、
说谎的匹诺曹 2011-04-18
  • 打赏
  • 举报
回复
我要疯了
说谎的匹诺曹 2011-04-16
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 raoyongchao 的回复:]

待机的情况下service不正常工作,你这个情况我遇到过,要设置一下PowerManager,让待机的情况下也能分配到cpu,具体怎么设置SDK上说的很清楚,我就不多说了....
[/Quote]
是不是在onCreate()里添加下面的代码?
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"");
wakeLock.acquire();

添加后问题依然存在啊

raoyongchao 2011-04-16
  • 打赏
  • 举报
回复
待机的情况下service不正常工作,你这个情况我遇到过,要设置一下PowerManager,让待机的情况下也能分配到cpu,具体怎么设置SDK上说的很清楚,我就不多说了....

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧