wakelock

Should I call WakeLock before creating a notification?

萝らか妹 提交于 2019-12-04 08:39:48
I'm adding notifications to an Android app and only have the emulator to test with at the moment. When a notification is received, my onMessage() method in my GCMBaseIntentService subclass (GCMIntentService) is called. From here I create a notification to appear. If I turn the emulator on standby, no notification is seen (I do t know if it would be heard on a device?). So should I be calling WakeLock to wake the device before creating the notification? Thanks I'm not sure if the emulator being in standby is equivalent to a locked device. If it is, you should definitely call WakeLock in order

do I need a wake lock in my broadcastreceiver if I'm not starting a service or an activity?

心不动则不痛 提交于 2019-12-04 05:51:33
I have a broadcastreceiver called by an Alarm (scheduled with AlarmManager). In this receiver I'm only querying a register from the database, and launching a notification. I readed that a wake lock is needed when a service or an activity is started from a broadcast receiver, but, do I need a wake lock if I only want to show a notificacion (in the notification panel)? In this receiver I'm only querying a register from the database, and launching a notification. Do not do database I/O on the main application thread. I readed that a wake lock is needed when a service or an activity is started

Help with PROXIMITY_SCREEN_OFF_WAKE_LOCK in Android

℡╲_俬逩灬. 提交于 2019-12-04 05:16:23
I've enabled the proximity wakelock in my app, and it turns off the screen when the proximity sensor detects something. But there is a problem when the screen wakes back up -- it goes to the lockscreen, not my app. This happens regardless of the time that the screen was off (even if the sensor is cleared after a few seconds). Here's the code I used: int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; mProximityWakeLock = pm.newWakeLock(PROXIMITY_SCREEN_OFF_WAKE_LOCK, LOG_TAG); if(!mProximityWakeLock.isHeld()){ mProximityWakeLock.acquire(); } Is there any way to correct that behavior? You can dismiss the

When will android stop its cpu without wake lock?

北慕城南 提交于 2019-12-04 04:24:20
I know android use wake lock to keep cpu running or screen on. It's obvious that screen wake lock prevents the user active timer from turning off the screen after a period of user inactivity. But I'm wondering when exactly will the cpu wake lock take effect. 1.If I create a new thread and keep draining cpu in background with out any wake lock, turn off the screen will not stop it. Will it stop and when will it stop? 2.What about a thread scheduled with Timer.schedule()? 3.It leads to another question, if I keep a long socket connection in a service, which is blocked at socket.read(). Do I have

How to wake up Android Wear when it is in sleep mode?

邮差的信 提交于 2019-12-03 12:46:12
When Android Wear goes to sleep mode (screen dimmed), some parts of my code are not executed. I use Timer in background service to trigger some actions, such as sending data from wear to mobile, but the data is not sent. It is sent when I tap the screen to wake it up. I also try to use Timer trigger a notification with vibration when the screen is off, but it doesn't appear until I tap the screen. In debug mode (either Bluetooth or USB), data sending and notification work fine. I suspect this is because when Android Wear is in sleep mode, its CPU works at minimum level because the Timer is

Foreground service not receiving location updates in Android 7.0+ when screen is off

断了今生、忘了曾经 提交于 2019-12-03 11:53:41
问题 I am trying to create an Android application that continuously logs device location data in realtime while the device screen is off. My code works correctly with Android 6.0 and earlier but it seems that Android 7.0+ breaks my app. I have implemented an Android foreground service that uses a wakelock and subscribes to the Google FusedLocation API. Once the screen is turned off the onLocationChanged callback is never triggered. Has anyone seen a solution to this problem? I have tried disabling

Foreground service not receiving location updates in Android 7.0+ when screen is off

南笙酒味 提交于 2019-12-03 03:27:15
I am trying to create an Android application that continuously logs device location data in realtime while the device screen is off. My code works correctly with Android 6.0 and earlier but it seems that Android 7.0+ breaks my app. I have implemented an Android foreground service that uses a wakelock and subscribes to the Google FusedLocation API. Once the screen is turned off the onLocationChanged callback is never triggered. Has anyone seen a solution to this problem? I have tried disabling Battery Optimization through the Android Device Settings for my app as well as for the Google Services

GPS Location tracking even when app is closed(Not running in Background)/ScreenLocked

烈酒焚心 提交于 2019-12-02 22:07:56
问题 I want to track user location very similar to strava, even after the is closed. I tried AlarmManager but it's not giving me execution after every one minute 回答1: Just using a Service as BiGGZ explained won't work in case the device enters sleep mode. The Service won't be killed though but your app won't get any CPU. Therefore you would have to acquire a partial Wakelock to prevent the device from entering sleep mode. @Override public void onCreate() { super.onCreate(); PowerManager pm =

Android doze mode and foreground service

蹲街弑〆低调 提交于 2019-12-02 20:36:58
问题 I read many questions here about doze mode like Android doze mode, Android N Doze mode - how to keep background download and processing?, Wakelock and doze mode and many others. But in many replies, opinions is different. I can't test it by myself (emulator does not support my processor, and my only test device is android 5.1). I would like to know the next situation. I have an activity, which controls the media player. On devices with android 6.0 and higher it wouldn't work as expected cause

Service pauses on screen lock

ⅰ亾dé卋堺 提交于 2019-12-02 12:43:56
问题 For testing purposes i have made a service that beeps every 1 minute. (No client-server interface yet). It beeps okay when the screen in on, but when it goes to sleep the beeping stops. I am making an application that has to periodically poll the a server for something. For this, I am trying to create a service that'll constantly be running in the background, poll the server every 1 min and then based on the reply from server it shall generate a task bar notification. I have a test activity