android-wake-lock

wakeLock does not wait for network connectivity

喜欢而已 提交于 2019-12-02 10:12:55
问题 I am using a wakelock for a alarm to update the app state regularly. The wifi takes a while to connect on Samsung phones. Also the "keep awake" option on Wifi does not work on Samsung phones (nor are they interested in fixing the issue). So when the wakelock does happen, it should wait for wifi to connect. Do I need to create a listener for the wifi connectivity for this to work, or should wakelock, kinda block for that wifi to connect ? mWakeLock = ((PowerManager) getSystemService(POWER

Code gets stuck at acquiring wake lock while registering with GCM

一个人想着一个人 提交于 2019-12-02 03:36:16
问题 I am using GCM for push notifications for my project, but am stuck at acquiring wake lock. Log message: 09-03 17:04:05.003: V/GCMBroadcastReceiver(5772): onReceive:com.google.android.c2dm.intent.REGISTRATION 09-03 17:04:05.003: V/GCMBroadcastReceiver(5772): GCM IntentService class: example.pro.GCMIntentService 09-03 17:04:05.049: V/GCMBaseIntentService(5772): Acquiring wakelock Below is my manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android

Code gets stuck at acquiring wake lock while registering with GCM

馋奶兔 提交于 2019-12-01 22:51:17
I am using GCM for push notifications for my project, but am stuck at acquiring wake lock. Log message: 09-03 17:04:05.003: V/GCMBroadcastReceiver(5772): onReceive:com.google.android.c2dm.intent.REGISTRATION 09-03 17:04:05.003: V/GCMBroadcastReceiver(5772): GCM IntentService class: example.pro.GCMIntentService 09-03 17:04:05.049: V/GCMBaseIntentService(5772): Acquiring wakelock Below is my manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="example.pro" android:versionCode="1" android:versionName="1.0" > <uses-sdk

Is using WakeLock overkill while using WifiLock on Android?

江枫思渺然 提交于 2019-12-01 20:05:06
My audio streaming app is working correctly with only WifiLock. But some devices report that when they turn off the screen, connection is cut and audio streaming is topped. (They say this does not happen on 3G) So, I thought maybe I can also use a Partial WakeLock. I am not sure if this fixes the issue but I think it is an option. At the same time, adding a WakeLock while a basic WifiLock is working may deplete the battery faster and may not fix the issue. What do you think about adding a WakeLock too for this kind of issue and app? private static WifiLock wifiLock = ((WifiManager) appInstance

Activity Recognition does not work after phone goes asleep

耗尽温柔 提交于 2019-12-01 00:23:10
Disclaimer: this is not duplicate of Activity Recognition stops receiving updates when phone goes to standby(screen off state) because I'm already using that approach and it does not help. Problem: It seems that Activity Recognition service stops working and is not sending any updates when device goes asleep. It works OK (recognized activities are stored to sqlite) when device is not asleep but as soon as I press power button on HTC M8, nothing is stored from this moment until I wake up the device but pressing power button again. Some details how I'm doing activity recognition: Requesting

Activity Recognition does not work after phone goes asleep

∥☆過路亽.° 提交于 2019-11-30 19:41:11
问题 Disclaimer: this is not duplicate of Activity Recognition stops receiving updates when phone goes to standby(screen off state) because I'm already using that approach and it does not help. Problem: It seems that Activity Recognition service stops working and is not sending any updates when device goes asleep. It works OK (recognized activities are stored to sqlite) when device is not asleep but as soon as I press power button on HTC M8, nothing is stored from this moment until I wake up the

Disable Screen Lock(Power) Button in Android

只愿长相守 提交于 2019-11-30 14:18:46
I want that when my application is running the power button (which upon pressing locks the screen & screen goes BLACK), should be disabled. So that the user cannot lock the screen. I have noticed this thing in Samsung Galaxy S phone's Default Camera App. That's the same reason I am trying to do the same. I have also a Camera related App. try this one int val=android.provider.Settings.System.getInt(getContentResolver(), SCREEN_OFF_TIMEOUT); android.provider.Settings.System.putInt(getContentResolver(), SCREEN_OFF_TIMEOUT, -1); Toast.makeText(this, "Disabled Screen Timeout", Toast.LENGTH_LONG)

Android Espresso, Wake up device before test. How to use a custom manifest for test?

牧云@^-^@ 提交于 2019-11-30 06:55:42
问题 I've been writing tests with androids new espresso framework and find that it works well. One annoying thing (not particular to espresso) is that I have to make sure my screen is awake and unlocked for the tests to run. I found a workaround (through various sources) however I am not sure the best way to integrate it. So this is what I did, in my "Home" activity I have the following code: Home.class: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*******

what is the proper, non-deprecated way to wake up the device?

折月煮酒 提交于 2019-11-30 03:55:21
My requirement is: after a GCM message arrives, the device should wake up to display a high-priority notification. The device should turn the screen on . Currently I'm using WakeLock to achieve this. The newWakeLock() method expects a lock level AND a flag to be passed (as the 1st param, bitwise or'd). I'm using PowerManager.ACQUIRE_CAUSES_WAKEUP flag since it does exactly what I need. However, I'm a bit frustrated about the lock level. So according to the docs , I got the following options: PARTIAL_WAKE_LOCK - not compatible with ACQUIRE_CAUSES_WAKEUP / doesn't turn the screen on SCREEN_DIM

Does the Android OS release a wakelock if the app or service holding it is killed?

一曲冷凌霜 提交于 2019-11-29 20:35:27
I have question about wakelock. In cases shown below, does android OS release wakelock ( PARTIAL_WAKE_LOCK if you need to specify) to prevent wakelock was left acquired and wasting battery until turning power off (not sleep). Case 1-a: App has acquired wakelock (w/o timeout option) in one of its threads (please think it is reasonable in this case) and it was designed to release wakelock when critical task was finished. App can be killed by taskmanager or notorious taskkiller, and app has no chance to let its thread release wakelock. What happens to that wakelock? Case 1-b: (If answer to case 1