sendMessage doesn't work properly (Wearable)

三世轮回 提交于 2019-11-27 19:35:46

问题


If I'm sending some bytes using sendMessage from Huawei p9 (Android 6.0) into Android Wear (Sony) the messages are not delivered if the screen of handheld device is turned off. The notifications inside wearable are not updated until the screen in the phone is turned on (in 1 minute)! Will setUrgent help? I already added the application in "list of granded applications" that can work while the screen is off. The application already works in WAKELOCK state.

Is it a feature for all Android 6.0 and newer devices?

IS IT POSSIBLE TO AVOID THIS? ANY CLUES?


回答1:


I've waste 3 days to find the solution To fix this problem just enable for ALL applications in the preferences:

protect application with battery saver

Detailed:

To access this power profiles section

Go to the System settings. (which you can either find in the quick toggles portion of the notification shade by pulling down the status bar on the top portion of the screen) Scroll down to Advanced Settings and head on over into Battery Manager. Go to Protected Apps selection. (This is what you’re looking for here. and this will control what’s allowed to run when the screen is off and what isn’t.)

http://itechify.com/2016/02/01/how-to-fix-missing-push-notifications-on-huawei-smartphones/




回答2:


I've got a Huawei Honor 6X running Android 7.0 and EMUI 5.0. I was having trouble getting notifications on my Pebble Time after the screen was locked due to Huawei's battery optimization service killing off processes. The instructions provided by Vyacheslav may be applicable to previous OS and EMUI versions, but I couldn't find those options on my particular device. His answer did point me in the right direction, though. The notification problem was one of many that ended up being caused by overzealous power management (thanks a lot, Huawei #sarcasm). Here are the instructions for how I excluded apps from battery optimization on my phone:

  1. Open Settings on your device.
  2. Scroll down the list and select the Apps option.
  3. Select the Settings option (blue cog near the bottom of the screen).
  4. Select the Special access option under the Advanced section.
  5. Select the Exempt from battery optimization option.
  6. Find your app in the list and select it. You will probably need to change the option at the top from Allowed to All apps in order to see it.
  7. Change the setting from Don't allow to Allow, then select OK.

I'd like to mention that you may also need to go into System > Battery and change the Close apps after screen lock settings for your app. I had already performed this step in a previously unsuccessful attempt to fix the issue. When I have time, I may go back and test to see if both of these changes need to be done or if the battery optimization exclusion on its own takes care of it. In the meantime, if you exclude the app from battery optimization and it's still getting killed, do the lock screen change as well.



来源:https://stackoverflow.com/questions/41605364/sendmessage-doesnt-work-properly-wearable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!