android-wake-lock

What happens to connection with BLE device when Android goes in sleep mode

时光毁灭记忆、已成空白 提交于 2019-12-13 15:11:39
问题 What happens to connection with BLE device connection when Android goes in sleep mode? So if application establishes a connection with BLE device and then Android goes sleep, will the connection be maintained? Will the application be informed about disconnects or re-connection? 回答1: BLE is devided in two parts, physical layer and link layer implemented in the BLE controller (frontend) upper layers implemented on host side (Android system) both parts connect via the HCI interface. (Which you

How to prevent app from closing when android device goes to sleep

点点圈 提交于 2019-12-13 07:49:52
问题 How do i prevent my app from closing when the device goes to sleep mode, i obsevered that anytime my device goes to sleep mode my app closes but i want it still open when my devices comes out of sleep mode. 回答1: Probably it is because you call the finish() method in the onPause(). 来源: https://stackoverflow.com/questions/28811831/how-to-prevent-app-from-closing-when-android-device-goes-to-sleep

Fullscreen notification when locked and screen is off(not working)

孤街醉人 提交于 2019-12-13 06:34:00
问题 I want to see a fullscreen activity when I receive a push notification. It works fine when the screen is on/unlocked. But when the screen is off and locked, I dont see the activity. Please help // Push notification received public class PushNotificationReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent pushIntent = new Intent(context.getApplicationContext(), CustomNotificationActivity.class); pushIntent.putExtra

How can I keep my screen on using a background running app?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 03:57:45
问题 I need to make an app that keeps the screen on even when the app is running in the background. I've tried: getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); But it only works when the app is running and can't run as a service. I've also tried wakelocks but SCREEN_BRIGHT_WAKE_LOCK and FULL_WAKE_LOCK have both been deprecated. The only wakelock left is PARTIAL_WAKE_LOCK. Is there someway to keep the screen on using the PARTIAL_WAKE_LOCK, ACQUIRE_CAUSES_WAKEUP, and some loops

BroadcastReceiver has no internet access

巧了我就是萌 提交于 2019-12-13 01:36:18
问题 I'm facing a problem with my broadcast receiver. I have set an alarm for 6am, it has to fire my broadcast receiver, which only has to download some data from internet and process it. If I set the alarm for 3pm, for example, it works fine. But the problem is at 6am, it fails downloading because it does not have network connectivity. I perform a partial wake lock before attempting download. Can it be related to this? Does the phone enter some deep sleep and partial wake lock is not enough? What

How to prevent app from closing when android device goes to sleep

爷,独闯天下 提交于 2019-12-12 07:06:40
问题 How do i prevent my app from closing when the device goes to sleep mode, i obsevered that anytime my device goes to sleep mode my app closes but i want it still open when my devices comes out of sleep mode. 回答1: Probably it is because you call the finish() method in the onPause(). 来源: https://stackoverflow.com/questions/28811831/how-to-prevent-app-from-closing-when-android-device-goes-to-sleep

Wake lock required for BroadcastReceiver while phone sleeps?

穿精又带淫゛_ 提交于 2019-12-12 05:03:39
问题 Trying to write a Broadcast Receiver that processes incoming SMSs. Do I need to use a wake lock / partial wake lock, for this application to work, in spite of device going to sleep due to lack of foreground activity ? 回答1: I tend to extend a WakefulBroadcastReceiver to simplify things, so in a way yes. For example: public class MyBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final ComponentName comp = new ComponentName

When to acquire wakelock for an intent service?

烈酒焚心 提交于 2019-12-12 01:44:14
问题 I am trying to understand the use of partial wake locks in android. I have a wakeful intent service which starts another intent service. If I don't acquire a wakelock for the called intent service, the intents will be processed when the CPU wakes up? Is there any scenario where these intents are not processed at all? 回答1: If you call startService() [whether directly or by calling send() on a service PendingIntent], it starts up the OS's process of spinning up that service. The device going to

Wake Lock not working properly

十年热恋 提交于 2019-12-11 18:41:25
问题 I apologies in advance if I'm not good in writing English. I'm writing a simple task app that remind me with alarm in specific time. Below I set alarm with AlarmManager : private static void setAlarm(Context context, Calendar calendar, PendingIntent pIntent) { AlarmManager alarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar

Android OS shuts down the Wakelock + AlarmManager after a few minutes

这一生的挚爱 提交于 2019-12-11 07:14:27
问题 Description I am developing an app (for testing purposes), that every 60 seconds will save a word in a database (using SQLiteOpenHelper). I am trying to achieve that by using AlarmManager (setRepeating) + Wake Lock (PARTIAL_WAKE_LOCK). It is important that the app also runs even if the screen is black. I tested my app for 2 days, tried several approaches but i have 1 issue which i can´t figure out. The best result i got code-wise is what i posted. I tested the app on 2 different phones a