android-wake-lock

Android - How can I wake up the phone from a hard sleep to take a picture?

十年热恋 提交于 2019-11-27 01:29:24
问题 I want to take pictures from the Android device's camera periodically over a matter of hours, to create a time lapse video effect. I set an Alarm Manager with an AlarmManager.RTC_WAKEUP flag set to start up a service every few minutes. The service holds a partial wakelock, does some work, and then calls a Broadcast Receiver through the Alarm Manager which starts up an Activity. The activity is created (or is resumed), turns on it's own wakelock, and sets up the camera preview surface. Once

Android: Wake & unlock phone

浪尽此生 提交于 2019-11-27 01:25:21
问题 I am trying to figure out how to wake and unlock the phone with a service. I have been referring to this post but, I can't figure out why it isn't working. This is the code that I have so far: public class WakephoneActivity extends Activity { BroadcastReceiver mReceiver; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent

Turning on screen from receiver/service

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 22:16:23
I would like my app to be able to turn the screen on and display my app. Let's say I'm setting an alarm and every hour I want my app to be displayed for 2 mins before the device naturally sleeps. I see that WakeLock (FULL_LOCK) and KeyguardManager are deprecated. I have created a WakefulBroadcastReceiver and service and these are working. @Override protected void onHandleIntent(Intent intent) { // I need to show the screen here! for (int i=0; i<5; i++) { Log.i("SimpleWakefulReceiver", "Running service " + (i + 1) + "/5 @ " + SystemClock.elapsedRealtime()); try { Thread.sleep(5000); } catch

PowerManager.PARTIAL_WAKE_LOCK android

风流意气都作罢 提交于 2019-11-26 14:55:29
问题 I am very confused whether to acquire this wakelock. E.g. I have this type of code that is called from onReceive() of a BroadcastReceiever (CONNECTIVITY_CHANGE, BOOT_COMPLETED etc) asynchronously i.e. I am launching an IntentService from onReceive() which performs heavy lifting. private static void insertInDatabase(Context context /*, some data to be inserted in database*/) { Database helper = Database.getInstance(context); PowerManager pm = (PowerManager) context .getSystemService(Context

Samsung “App optimisation” feature kills background applications after 3 days

假装没事ソ 提交于 2019-11-26 14:19:08
问题 We are currently developing an Android app that is a fitness-tracker application. It runs constantly in the background, and it works fine on most devices, but we've been having issues with the application dying completely on some Samsung devices. After some investigation, it seems like some Samsung devices has a completely custom "App Optimisation" feature (http://forums.androidcentral.com/samsung-galaxy-s6/599408-app-optimisation-after-updating.html), which is basically a (very) primitive

Android - Wake Up and Unlock Device

末鹿安然 提交于 2019-11-26 10:20:39
问题 Application description: The application is intended as a safety program for a specific client (not to be deployed publicly). When the application has not detected movement for a certain period of time, the application should sound an alarm and bring itself to the foreground if it is in the background or the device is asleep. The problem: In the event the device is asleep and locked, we need to wake up and unlock the device. Using various techniques found here on SO and other places, we\'ve

Turn off screen on Android

a 夏天 提交于 2019-11-26 08:09:40
I am trying to turn on and off the display after a certain action happens (Lets just worry about turning the screen off for now). From what I understand from wake lock, this is what I have: PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag"); When I read other posts on stackoverflow and else where, they seem to tell me that PARTIAL_WAKE_LOCK will turn the screen off. But if I read the SDK it says that it will only allow the screen to be turned off. So I think this isn't right. Any hints

Turning on screen from receiver/service

人走茶凉 提交于 2019-11-26 07:34:43
问题 I would like my app to be able to turn the screen on and display my app. Let\'s say I\'m setting an alarm and every hour I want my app to be displayed for 2 mins before the device naturally sleeps. I see that WakeLock (FULL_LOCK) and KeyguardManager are deprecated. I have created a WakefulBroadcastReceiver and service and these are working. @Override protected void onHandleIntent(Intent intent) { // I need to show the screen here! for (int i=0; i<5; i++) { Log.i(\"SimpleWakefulReceiver\", \