screen-off

How to prevent phone from going to idle mode

≡放荡痞女 提交于 2021-01-29 07:37:29
问题 I've developed an application that streams music (via internet connection) using service and having trubles streaming content without phone going idle. While i was developing my application each time i tried case mentioned below the music was reproducing fine. Use case : search song, select song from results, play song, screen off -> auto play next song from result list I'm developing using real device - Huawei Mate 20 Lite - OS v8.01 so while debugging it gotta use USB cabel. Like i said

Timers not running when screen is turned off / device is locked in iOS

☆樱花仙子☆ 提交于 2020-01-04 02:56:10
问题 The app is in the background and it receives a callback upon disconnection with the BLE device, after which the app has to wait for sometime(1minute) and then execute some piece of code. The app behaves as expected even when in the background if the screen is turned on. But if the screen is turned off then the timer is not working and the app is not executing as expected. This is the code in AppDelegate to start a timer in background: func startTimerWith(timeInterval: TimeInterval) {

How to continue monitoring iBeacon when screen is off in iOS?

不想你离开。 提交于 2020-01-04 01:19:08
问题 I am developing an iOS app to monitor iBeacons. It works well in both foreground and background. I also need it to keep monitoring even when the screen is off. Now my problem is, when I turn off the screen with the shoulder button, NSLog shows that the iBeacon signal goes off (RSSI=0, beacon.accuracy=-1.0) accordingly, and 10 seconds later, there is no beacon found at all, while the delegate method locationManager:didRangeBeacons:inRegion: is called continuously. It seems that the app is

Obtaining sensors data while the screen is off (Android 4.0+)

送分小仙女□ 提交于 2019-12-11 18:46:03
问题 As far as I know on Android devices there is no 100%-sure way to get the data from device sensors while the screen is off. There are some workarounds, but they do not work always. But all the posts I read were describing Android versions ~2.2. Does anyone know whether the bug was fixed in Android 4.0+ ? 回答1: This WakeLock works like charm. 来源: https://stackoverflow.com/questions/11612065/obtaining-sensors-data-while-the-screen-is-off-android-4-0

Android accessibilityservice whan screen off

独自空忆成欢 提交于 2019-12-10 16:34:37
问题 I have a problem with accessibility service in android. I want to retrive result of USSD command. What I try to do: I made an AccessibilityService from gist.github.com/qihnus/1909616 Deal USSD: Intent i = new Intent(Intent.ACTION_CALL); i.setData(Uri.parse("tel:*110*10" + Uri.encode("#"))); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_FROM_BACKGROUND); startActivity(i); Popup window with USSD result opens In AccessibilityService onAccessibilityEvent fired, and I get USSD

Android notification manager doesn't work with the screen is off

天涯浪子 提交于 2019-12-09 20:56:37
问题 I have a count down timer that when it goes off (to zero) it checks to see if the app has focus. If not it launches a notification in the notification bar. When you click on the notification is re-opens the app. Now all of this works fine but if the screen happens to go off, the timer keeps going and the notification is available at the right time but never actually vibrates or rings until i turn the screen back on. Then it displays the notification like it was waiting in a queue or something

Recognize volume button presses when screen is off Android

霸气de小男生 提交于 2019-12-06 07:18:05
问题 I am trying to recognize when the user presses the volume rockers when the screen is off to update an activity. From what I've read, BroadcastReceivers (I think) don't work when the phone is asleep, and so the only way to do this is to keep the activity running using a PARTIAL_WAKE_LOCK. My app is a basic one that shouldn't use too much battery, but I'm concerned that using a PARTIAL_WAKE_LOCK might drain the battery (which defies the purpose of recognizing button presses when the screen is

Android notification manager doesn't work with the screen is off

怎甘沉沦 提交于 2019-12-04 13:23:01
I have a count down timer that when it goes off (to zero) it checks to see if the app has focus. If not it launches a notification in the notification bar. When you click on the notification is re-opens the app. Now all of this works fine but if the screen happens to go off, the timer keeps going and the notification is available at the right time but never actually vibrates or rings until i turn the screen back on. Then it displays the notification like it was waiting in a queue or something. How do I get it so that the notification manager will actually alert the user when the screen is

how to get broadcast for screen lock in android

让人想犯罪 __ 提交于 2019-12-01 00:44:55
How to get trigger that screen is locked or on in android?? i tried using SCREEN_OFF & SCREEN_ON action in broadcast receiver but it's not working. public void onReceive(Context context, Intent intent) { Log.d("XYZ", "Screen ON/OFF"); Toast.makeText(context, "screen",10000).show(); if(intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { ....... } } in activity i have registered broadcast like- screen is object of my broadcast receiver IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); mContext.registerReceiver(screen, filter); Call the

how to get broadcast for screen lock in android

╄→尐↘猪︶ㄣ 提交于 2019-11-30 18:14:32
问题 How to get trigger that screen is locked or on in android?? i tried using SCREEN_OFF & SCREEN_ON action in broadcast receiver but it's not working. public void onReceive(Context context, Intent intent) { Log.d("XYZ", "Screen ON/OFF"); Toast.makeText(context, "screen",10000).show(); if(intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { ....... } } in activity i have registered broadcast like- screen is object of my broadcast receiver IntentFilter filter = new IntentFilter(Intent.ACTION