wakelock

Android - Turn off display without triggering sleep/lock screen - Turn on with Touchscreen

天大地大妈咪最大 提交于 2019-11-27 05:10:48
问题 I have been trying to find a way to turn off the display, and wake up from the user touching the touch screen. The device is in an embedded environment where the device is a tablet and the user does not have access to anything except the touch screen (no buttons at all). It is connected to power so the battery won't be a problem, but when I detect no activity I want to turn off the screen so it isn't staring them in the face all day and doesn't reduce the life the LCD backlight. I maintain a

Android: Keep camera-LED on after screen turns off

时光怂恿深爱的人放手 提交于 2019-11-27 03:32:03
问题 since i'm at the beginning with Android coding i hesitated to post my question, but now i'm at the point where i can't resist. I have a service which turns on the camera-LED onCreate: @Override public void onCreate() { // make sure we don't sleep this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE); this.mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SleepLED"); this.mTimer = new Timer(); this.mTimerTask = new TimerTask() { public void run() { // turn on the LED

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

How to make the Android device hold a TCP connection to Internet without wake lock?

你。 提交于 2019-11-27 00:24:58
问题 I want my application to be connected to server though the mobile connection, yet allowing the device to go into sleep mode. I expect it to wake up when IP packates arrives. How can this be done? How to receive "interrupts" from the Internet without draining battery? 回答1: When you are blocked on a read from a tcp stream the device can go into a deep sleep and when tcp traffic comes in it will briefly wakeup the device, as soon as a bit is read in you start a wakelock until you have received

Service, WakeLock

佐手、 提交于 2019-11-26 23:26:54
问题 I am bit confused after going through the questions & answers in Stackoverflow about WakefulIntentService . I just would like to get some knowledge on this topics to make sure my understanding is correct, please feel free to correct me, if I am wrong. I built a small application, where I am using a background Service that keeps playing music whenever the user shakes the mobile. I tested after the device is locked and screen is turned off and it works as expected. What I am hearing from this

AlarmManager and WakeLock

自古美人都是妖i 提交于 2019-11-26 21:57:33
问题 I want to use an alarm manager in my activity. I set up an alarm at the onPause method of main activity like this, Intent intent= new Intent(namaz_vakti_activity.this, namaz_vakti_activity.class); PendingIntent sender = PendingIntent.getActivity(this, 1234567, intent,Intent.FLAG_ACTIVITY_NEW_TASK); AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); eltime=Calendar.getInstance().getTime().getHours()*60+Calendar.getInstance().getTime().getMinutes(); eltime=(long)(Sun_Rise*60)

How to disable power button?

≯℡__Kan透↙ 提交于 2019-11-26 21:34:59
问题 Is it possible to override the functionality of the android power button ? I want to 'disable' the power button. My plan is to override the functionality of this button to do nothing ( {}; ) Well my main idea is to disable the turning the screen off. I want when someone press the power button nothing to happen. How can I do this ? 回答1: Is it possible to override the functionality of the android power button ? I want to 'disable' the power button. Fortunately, this is not possible, except

Wake locks android service recurring

半腔热情 提交于 2019-11-26 19:47:08
问题 I have this application that needs to run a service (background) that beeps periodically. The phone needs to beep the entire day for 5 seconds every one minute (used a handler in the service). I have implemented this service which does this perfectly, but when the phone goes into deep sleep mode, the execution stops of this handler stops. Using this answer from the question in SO, I managed to use wake locks and it works fine. But when I explicitly put the phone in deep sleep mode, the

OnPause and OnStop() called immediately after starting activity

醉酒当歌 提交于 2019-11-26 19:02:37
问题 I have an activity that needs to turn screen on(if offed) when it is started. So in onCreate, I have: this.getWindow().setFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); Using this with help of wakelock in broadcasr receiver , I am able to

Light up screen when notification received android

淺唱寂寞╮ 提交于 2019-11-26 18:04:10
问题 I have a service running for my application to send notification every hour. This is working fine as i heard a sound and a vibration every hour because of my notification but i also want that my notification light up my screen as well. But i am unable to light up my screen when notification appears. 回答1: PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); boolean isScreenOn = pm.isScreenOn(); Log.e("screen on.................................", ""+isScreenOn); if