- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我的 android 应用程序收到如下崩溃报告。(非常罕见)
java.lang.RuntimeException: WakeLock under-locked GCM_LIB
at android.os.PowerManager$WakeLock.release(PowerManager.java:325)
at android.os.PowerManager$WakeLock.release(PowerManager.java:300)
at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:252)
赞java.lang.RuntimeException: WakeLock under-locked C2DM_LIB ,我可以尝试~捕捉或使用 isHeld()
但我不确定这是最好的解决方案,我想知道为什么会这样。
一些猜测是 BroadcastReceiver 和 Service 在不同的进程中喜欢http://groups.google.com/group/cw-android/browse_thread/thread/9716bc101ce72fb4 .
但这可能吗?我从未在 list 中使用过 android:process,所以 BroadcastReceiver 和 Service 应该在同一个(主)进程中,不是吗?
最佳答案
+NoraBora 这是您包含在项目中的 GCM 库中的错误。这个错误仍然存在于 gcm.jar 的 r3 版本中
您可以在此问题线程中找到更多信息:https://code.google.com/p/android/issues/detail?id=36364#makechanges
正如马克所说:
Yup, ran into those with WakefulIntentService. If you're willing to create your own fork of GCMBaseIntentService, wrap the WakeLock release() call in a check of isHeld() to avoid this crash.
关于android - WakeLock 未锁定 GCM_LIB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15809345/
我的应用程序使用需要互联网连接才能在后台运行的服务。但是,当 android 进入休眠状态时,我的服务无法再访问互联网。我已经看到 wakelock 可以修复它,但它似乎只是保持网络正常运行就有点矫枉
我有一个应用程序需要连续使用 WiFi 和加速度传感器来收集数据,因此我需要使用 WakeLock 方法来保持这些传感器处于 Activity 状态。但现在我遇到了手机运行几个小时后有时会随机重启的问
我的应用程序有一项服务,基本上可以解析 X 数量的 RSS 提要。大多数提要都相当小,但有些提要的大小可能在 1MB 左右。我在服务的 AsyncTask 中解析它们。解析可能相当耗时,具体取决于用户
我是 WakeLock 概念的新手,需要您的帮助。 问题: 我假设 WakeLock 是某种类型的锁,当执行代码持有它时会阻止设备休眠。如果设备已经处于 sleep /待机模式,代码会执行吗?假设它永
Tag name should use a unique prefix followed by a colon (found tag). For instance myapp:mywakelockta
免责声明:我的应用已经在没有任何唤醒锁的情况下运行了 1 年多,并且对于大多数设备来说一切都很好。 我正在跟踪 GPS,它的工作原理如下: AlarmReceiver 每 5/10/15 分钟启动一次
pm 和 keepScreenOn 变量是全局定义的。 我在 OnCreate 方法中获取 PowerManager.WakeLock: pm = (PowerManager) getSystemSe
我开发了一个名为 Multi Countdown Timer 的 Android 应用程序,我们可以在其中同时启动多个计时器。该应用程序使用前台服务在后台运行,以便持续运行并覆盖 Android 的
我有一个信号让我的应用休眠指定的分钟数(使用 AlarmManager),然后再将其唤醒。 一切正常,只是屏幕永远不会亮起。我正在使用 BroadcastReceiver 类中的唤醒锁: K
在 cat/proc/wakelocks 之后我得到了这样的东西。但是列中的数字是什么意思? ------ KERNEL WAKELOCKS (/proc/wakelocks) ------
我目前正在开发一个不时运行服务的应用程序。目前,该服务获取一个唤醒锁,读取一些传感器并通过 WIFI(如果有)发送一些信息。现在我想知道唤醒锁是否会影响传感器和连接性。是否可以在没有任何唤醒锁的情况下
我有一个按钮,当您单击它时,它会打开唤醒锁,而且效果很好!但是,当您再次单击它时,它应该会关闭 WakeLock,但它只会让应用程序崩溃!任何帮助将不胜感激,我知道这不是因为我正在更改图像,因为那部分
我只是想知道我这样做是否正确;我正在编写一个通知应用程序,它可以在手机休眠时显示通知 禁用键盘锁 获取唤醒锁 显示通知 设置超时警报并重新启用键盘锁并在用户不触摸屏幕时释放唤醒锁。4.1 用户触摸屏幕
我有一个 BroadcastReceiver,它在发送 SMS 后监听“SMS_SENT”Intent。据我所知,SMSManager 确实提供了一个唤醒锁,以便它可以实际发送 SMS(我没有这方面的
我正在使用 WatchFace API(扩展 CanvasWatchFaceService)为 Android Wear 开发一个表盘。 我使用了 here 中的代码构建一个每秒运行代码的自动收报机。
我正在向 Android 应用添加通知,目前只有模拟器可以测试。收到通知后,将调用 GCMBaseIntentService 子类 (GCMIntentService) 中的 onMessage()
我已经阅读了在这里找到的关于 WakeLock 的各种解决方案,例如在 AndroidManifest.xml 中添加 Permission 以及确保将 GCMIntentService 的 Cons
我想在我的 Activity 中使用警报管理器。我像这样在主要 Activity 的 onPause 方法上设置了一个警报, Intent intent= new Intent(namaz_vakti
我需要在 Android 手机上进行后台 GPS 跟踪,目前我计划有两种情况: 当手机连接到(汽车)充电器时,获取频繁的 GPS 位置(每分钟)。 当手机未连接充电器时,仅每 5-30 分钟轮询一次位
我有一个 MediaPlayer 在服务中运行,该服务正在播放来自 URL 的音频(流)。截至目前,它似乎运行良好,甚至在我将手机置于待机状态时继续播放。 我目前没有获得唤醒锁。我的问题是: 在我的情
我是一名优秀的程序员,十分优秀!