Questions tagged [wakelock]

Refers to PowerManager.WakeLock, a class from the Android SDK belonging to package android.os. Its responsibility is requesting CPU resources in the context of power management. If no wake locks are taken, Android will shut down the CPU.

wakelock
Filter by
Sorted by
Tagged with
5 votes
0 answers
569 views

Proximity wake lock not always turning screen back on

I'm trying to create a custom phone app, and one of the features i'm trying to implement is to turn the screen off when the phone is brought close to face to avoid accidental touches. I have read ...
David Barishev's user avatar
1 vote
1 answer
565 views

Combining Battery and Wakelock does not give desired outcome

Currently I'm trying to build an app that does the following: 1) When connected to power do not allow device to go to sleep 2) When disconnected from power allow the device to go to sleep Currently ...
Robin's user avatar
  • 854
0 votes
2 answers
102 views

Wakelock lost after phone call intent

An Android Java app developed in Android Studio should track the gps location and call a phone number to trigger a street barrier. The app uses SCREEN_DIM_WAKE_LOCK to keep the device running, which ...
Nexave's user avatar
  • 3
0 votes
1 answer
77 views

To detect the screenlock even when the app is sleeping

I have an android application that needs to be locked (redirect to the login page) whenever the user presses the lock button. The user can lock the phone while on my application or while on other ...
Nitin Misra's user avatar
0 votes
1 answer
543 views

How to keep GPS and socket connection on even when the mobile screen is off?

Problem: I have to periodically send the GPS data to a server. Approach: I have used alarm manager which runs a background service. It acquires GPS data and sends it over the socket. It works fine ...
Pooja M Gupta's user avatar
0 votes
0 answers
194 views

Execution of ForegroundService is stopped even though WakeLock is acquired

I´m trying to have a service that executes some code in a Handler at every second. While the phone is connected to the PC everythings running fine. However as soon as I start the service while not ...
Maximilian Speicher's user avatar
3 votes
0 answers
337 views

Firing intent to ignore battery optimization not working in Ticwatch

I need to maintain a persistent internet connection for my Wear OS app and as the first step, I am requesting the ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission in my background service (...
higherDefender's user avatar
15 votes
0 answers
3k views

How to enable wake on usb (remote wakeup) in android?

I have an AOSP tree compiled on my board. I bought a wireless keyboard and connected it to my board via usb port. I expect when the board is in the suspend state, it will wakeup by pressing a key on ...
Saleh's user avatar
  • 1,901
3 votes
0 answers
278 views

Music Player Stuck partial wake locks (background)

I have an android music player and I see a "Stuck partial wake locks (background)" in the Play Console. I'm not sure how to fix it. I search my code and the only code that I find is the following when ...
Julia's user avatar
  • 1,359
2 votes
1 answer
2k views

Waking up the Device from a Lockscreen and showing an Activity

I'm coding an alarm application. When it's time to ring, I want the device to wake up and show my activity that allows the user to disable the alarm. It's working fine except for when the device is ...
Aulig's user avatar
  • 294
6 votes
0 answers
3k views

Error "WakeLock: GCM_HB_ALARM release without a matched acquire" in android studio

my app is crashing and I get this error in my logcat : 04-11 23:50:51.278 2294-26973/? E/WakeLock: GCM_HB_ALARM release without a matched acquire! 04-11 23:50:51.317 2294-4859/? E/ExecutionCriteria: ...
new user's user avatar
0 votes
2 answers
997 views

"Must specify a valid wake lock level" thrown only on Pixel 2 XL (API 22)

I am aquireing a wakelock like this: PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); mWakeLock = pm.newWakeLock(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WAKELOCK_TAG); ...
Benjamin Basmaci's user avatar
1 vote
1 answer
162 views

Service interrupted when the phone falls asleep

In my application I start a service containing a fileobserver to monitor a directory. My problem is that after a while the service is interrupted and if you wake up the phone the service starts again. ...
user10067214's user avatar
0 votes
0 answers
640 views

Detect Wake Locks programmatically

We develop a SDK that is heavily dependent on the location APIs of Android OS and Google Play Services. We have detected that there are too many wake ups causing Android Vitals to launch alerts in ...
tomacco's user avatar
  • 710
1 vote
1 answer
618 views

Prevent app from going on OnPause when turning screen off using partial wakelock

I'm trying to catch the volume Up/Down button press with the screen off, but despite acquiring a wakelock the app doesn't stay in the foreground when pressing the lock button. I have a breakpoint in ...
IAmAgainst's user avatar
1 vote
0 answers
37 views

AlarmReceiver Stay Awake (briefly)

I have read 100s of SO and other articles. I cannot find an answer. Thanks in advance for the help. Note: I save the major events in my app to sharedPreferences. This way I am able to record and "...
Frank Zappa's user avatar
3 votes
1 answer
1k views

What exact functionality stops working if a wake lock is not acquired and the device goes into sleep?

The last couple of days I've been trying to figure out which functionality in a service (background and foreground) stops working when the device falls into sleep without a wake lock. All the ...
Florian Walther's user avatar
4 votes
1 answer
2k views

Does a foreground service need a wake lockt to stay active after screen-off?

In different sources, I read that a foreground service requires a wake lock to stay active after the device goes to sleep. But when I test it by starting a foreground service and turning the screen ...
Florian Walther's user avatar
1 vote
1 answer
690 views

How to lock my screen and my app will continue running

I have an app that records users location and draws a polyline.I want to know how to do that when the user locks his screen.I've implemented a foreground service so the user can do whatever he wants ...
Alex's user avatar
  • 1,906
1 vote
1 answer
334 views

Problem keeping App Running when Phone locks

So I am having an irritating problem. I am currently working on an application that is used to track user's sleep. We have a service that runs sending out sonar and listening to the returning waves. ...
theMTGDeckGenius's user avatar
0 votes
2 answers
60 views

How to open application when screen is off

I want to open my application when I got a push notification. Now the application is not opening when the push received. Here is the code I am using, Added WAKE_LOCK Permission on manifest like, &...
SHIDHIN TS's user avatar
  • 1,629
2 votes
0 answers
149 views

How to activate a wakelock in android for all time?

For my Android 7.1 ROM, I need a special property. I want a wakelock to be active all the time. i.e. even when there is no playing music,... I want to have a active wakelock when I run dumpsys power. ...
Saleh's user avatar
  • 1,901
0 votes
1 answer
244 views

xamarin forms Android App crashes when BroadcastReceiver fires during Doze in OREO

I have a reminder app which needs to show reminders on time even if the phone is in Doze mode. This was appeared to be fine when compiling using the Android 7.1 SDK. My BroadcastReceiver gets a ...
Nick Jones's user avatar
6 votes
2 answers
4k views

Does service.startForeground imply wakelock?

Question I am wondering if we need to aquire the WakeLock or if the service.startForeground() command does that anyway for us? I didn't find anything in the documentation. Goal We want to remove ...
hb0's user avatar
  • 3,650
2 votes
1 answer
155 views

Can device sleep before foreground service?

I know that previously we needed to use WakefulBroadcastReceiver to ensure that between receiver onReceive and service onHandleIntent the device doesn't fall back asleep. Now Google seems to have ...
rcell's user avatar
  • 671
3 votes
2 answers
862 views

Does the CPU stay awake when the device is charging?

The documentation mentions that 6.0+ Android devices will not enter doze mode while charging, but what about regular sleep mode? I could not find anything that indicates that the CPU will turn off ...
daedsidog's user avatar
  • 1,732
2 votes
1 answer
810 views

Explicit Wakelocks with JobScheduler/JobInfo

I am refactoring this code: https://github.com/r3gis3r/CSipSimple/blob/master/src/com/csipsimple/utils/TimerWrapper.java which uses AlarmManager to schedule timers. I am refactoring the code to use ...
ssk's user avatar
  • 9,175
10 votes
2 answers
291 views

Incoming call listener sleeps after couple of hours

For the last couple of weeks I am facing an issue with telephony manager API in Android - listener for incoming call based on listener starting Recording and on end call stopping recording (The ...
Jhaman Das's user avatar
  • 1,114
1 vote
1 answer
3k views

Android prevent screen timeout

I got the following problem, I have an unity Game which I would like to run. During running the Game, it always lowers screen lighting and switch of after about 2,5 minutes. I already tried: ...
Franz's user avatar
  • 388
2 votes
0 answers
249 views

Wakelock and webview interval

I have a Activity contain a webview. Webview load a snippet of javascript that call a servcie api with a interval after 1 minutes. After I press power button, screen device is off and about 5 minutes, ...
phongnt's user avatar
  • 741
2 votes
1 answer
528 views

Security Exception requesting PARTIAL_WAKE_LOCK

I wrote a library which starts a STICKY Service when the main application calls a specific method. This Service acquires a PowerManager.PARTIAL_WAKE_LOCK during the execution of the onStartCommand() ...
Mattia Campana's user avatar
0 votes
1 answer
1k views

Android service destroy after lock screen

I am using MediaBrowserServiceCompat in my app to play music. I am also starting service with startService method within the service and also using startForeground with notification as well as using ...
Zohaib Ghafoor Baloch's user avatar
0 votes
1 answer
296 views

Music streaming, Google Developer Console warning: hanging partial wakelock

I have built an online clock radio for Android which also features an integrated music player that works as a foreground service with notification, and it has its own wakelocks - acquiring when ...
Ben's user avatar
  • 265
-1 votes
2 answers
773 views

Android : Screen is not waking up

I am working on calling feature and i want an activity to be opened and the screen to wake up whenever there is an incoming call. I am able to start the activity but am not able to wake up the screen. ...
Kunal's user avatar
  • 412
1 vote
0 answers
462 views

Android BroadcastReceiver vs WakefulBroadcastReceiver vs JobScheduler

I am in the process of moving a hybrid Cordova Android app with its own custom plugin from API 19 to 23. The plugin sets up broadcast receivers for the following 'AlarmManager.setInexactRepeating' ...
DroidOS's user avatar
  • 8,730
1 vote
1 answer
91 views

Activity does not start until the screen is turned on

My service starts an Activity like this: Intent intent = new Intent(context, CallMonitor.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); ...
almisoft's user avatar
  • 2,173
24 votes
5 answers
11k views

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

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 ...
Joshua W's user avatar
  • 4,973
1 vote
2 answers
1k views

Network retrofit 2 call after push notification received when phone is idle

Let's say my application receives a push notification from a server that carries an item ID. After receiving the push notification item's details have to be fetched from the server (using retrofit) ...
peter.o's user avatar
  • 3,500
0 votes
0 answers
158 views

Run a TimerTask or a Handler ALWAYS correctly

I have a problem (that's why I'm here :P): I am running a TimerTask and/or a Handler. They should do something every second, no matter if the screen is on or not (standby). The problem is, after some ...
Antonio Vlasic's user avatar
0 votes
2 answers
629 views

Will wakelock + handler allow the device to stay awake?

I am currently working on an app that starts an activity every 30 minutes using a Handler & WakeLock. But I was wondering as to the reliability of this method. I did check this post, but it doesn'...
user avatar
0 votes
1 answer
185 views

How to keep screen state with using Wakelock?

I used Wakelock in my application for fire CPU on when the device went to sleep but i don't want to turn on when screen is off, i mean, i want to keep state of screen and just turn on cpu for my ...
Fahim's user avatar
  • 394
1 vote
1 answer
1k views

Keep android app awake at all times

I have a tracking app that needs to send location updates to a web server every 5 seconds. This works fine as long as the app is awake/visible. If the device is locked the app is put to sleep after ...
Some1Else's user avatar
  • 755
1 vote
0 answers
603 views

Proximity and Wakelock in background service Android

I need help to stop a WakeLock in a service. Here is what i have tried: public class SensorSevice extends Service implements SensorEventListener { Sensor registerListener; SensorManager ...
Muhammad Badrudin's user avatar
0 votes
0 answers
538 views

wakelock fails to keep service alive

I am implementing simple timer and I require it to perfectly measure time. Problem is that even using foreground, START_STICKY and wake lock when timer is started somehow time measuring is killed ...
kolboc's user avatar
  • 815
0 votes
1 answer
455 views

Background service for continuous location update using fusedlocationAPI

following service is created to continuously update user location. User's location has to be tracked even app is in background, device is idle or screen is off or application is removed/killed from ...
jil123's user avatar
  • 99
0 votes
2 answers
942 views

Type of wakelock for waking cpu

I have got an alarm manager and I am working with some tasks in background with alarm managers. I use wakelock for waking CPU in order to finish my background work which causes the error below. I have ...
Fahim's user avatar
  • 394
0 votes
0 answers
193 views

Beacon connectivity not working when app is in sleep mode

I am working on ibeacon and it is working perfectly fine when app is in foreground or when device is awake but app is in background. The issue is when device goes to sleep mode. iBeacon default ...
Harneet Kaur's user avatar
  • 4,487
1 vote
1 answer
82 views

Android (C#) -- Service for incoming udp-broadcasts

I'm pretty new to Android programming that's why I need your advice. Current Situation: I built an Android application (C#) aswell as a regular Server application (C++) which runs on a Raspberry Pi. ...
oRole's user avatar
  • 1,326
0 votes
1 answer
788 views

Stop iPhone from going to sleep while running A-Frame web app?

Bear with me if this is a stupid question, I'm very new to AFrame and VR, but also programming in general. What I have gathered from google searches and the AFrame source code, is that Wakelock is ...
Harry's user avatar
  • 35
5 votes
1 answer
936 views

Android VoIP application: PARTIAL_WAKE_LOCK vs ignoring Battery Optimizations (doze whitelisting)

I'm working on a Voice over IP (VoIP) application using the SIP protocol which requires the application to be listening to incoming calls. This means the application must not sleep or die. For old ...
Emmanuel's user avatar
  • 17k

1
2
3 4 5
11