android-powermanager

Unlock the Screen Programmatically

允我心安 提交于 2019-11-27 23:55:06
问题 I have a share button in the GCM notification . On click of the share button, I need to launch share intent. Everything works perfectly. Only problem that I'm facing is Lollipop lock screen feature. When I click share button from lock screen, my intent dialog appears below the lock screen and user has to unlock the screen to see the dialog. I want to unlock the screen programatically, when share button is clicked. I tried with Power Manager, But all it's wakeClock flags are deprecated and

How do I avoid that my App enters optimization on Samsung devices

风格不统一 提交于 2019-11-27 05:41:14
问题 Smart manager kills an app that hasn't been used for 3 days. My app does some background work and hence, the user doesn't need to open it. What can I do so that it doesn't enter app optimization mode ( Android OS 5.0.2, 5.1.1) 回答1: Sadly, there is currently no way to prevent this. The only thing you can do is instruct users to disable optimization for your app. I did some research about this myself not long ago, here are some links I saved that might be interesting for you https://news

When does android device go to sleep mode?

对着背影说爱祢 提交于 2019-11-27 01:20:21
问题 I was searching SO and web but i couldn't find sufficient answer for my particular question. Ok here we go: Every user can modify screen timeout on android. (when screen turns off when its idle for __ seconds/minutes - users choice ). But user can modify ONLY screen timeout and not when device goes actually to sleep. I found here what happens when device goes to sleep: (Really nice answer by CommonsWare) Android Sleep/Standby Mode Ok my question is simple. How do i know when my phone will go

Check if battery optimization is enabled or not for an app

拈花ヽ惹草 提交于 2019-11-26 12:26:36
问题 Android 6 and 7 have some power optimizations (doze mode) which restrict app networking when device is not used. User may disable optimization mode for any app in Battery settings: Is it possible to check if optimization is enabled for my app or not? I need to ask user to disable optimization for better app functionality, but I don\'t know how to check it programatically. 回答1: This one was a bit tricky to track down: here's what you are looking for PowerManager.isIgnoringBatteryOptimizations(