- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我注意到我的音频流应用程序在 Android 6.0 设备上存在问题。音频流是通过 HLS 通过网络连接完成的。音频播放发生在具有 Activity 通知的前台服务中。我注意到的是,当应用程序进入休眠模式/应用程序待机时,wifi 连接丢失并且播放暂停。我的服务在前台并有一个 Activity 通知,根据文档,该通知应该使我的应用程序不被中断。我还获得并维护了一个 Wifi Lock。我读过有关将我的应用程序列入白名单的信息,但是像 Spotify 这样的应用程序不会请求任何特殊权限来避免此问题。有什么想法或建议吗?
最佳答案
推荐的解决方案是采用单独的进程,一个用于音频播放,一个用于 UI。 See this long thread for lots of details
这是 Hackborn 女士的相关部分:
... have your foreground service run in a different process than the activity. From what I can see, this will work fine. I would be interesting in seeing if you get the desired behavior there.
Also this is actually our recommended practice for this situation -- if you have a long-running foreground service, it should be in a separate process from the activity, so it doesn't force all of the memory associated with the activity to be kept around. (This is also why this bug got through, all of our [Google] apps use this pattern.)
关于android - 音频播放期间打瞌睡模式/应用程序待机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35438786/
目前我正在阅读有关 Android 7.0 的官方谷歌文档新闻 我无法理解一些事情。他们编写了 Doze,通过在用户屏蔽屏幕时关闭网络和 CPU 来延长电池生命周期。但这是如何运作的? 1.我的设备中
一切似乎都指向这两个命令: adb shell dumpsys battery unplug adb shell dumpsys deviceidle step 我关注了the instruction
我正在制作一个将在设备锁定时运行的应用程序,通过 Activity#setShowWhenLocked(true)。我不想阻止设备进入低功耗状态。我知道系统使用 Always-On Display 执
我需要在用户靠近给定地点时通知他。我为此使用地理围栏 API。当我使用模拟位置在 Android 模拟器上测试应用程序时,一切正常。与模拟位置的真实设备相同。但是当我走路并且我的手机处于深度 slee
我是一名优秀的程序员,十分优秀!