Android powermanager and powermanager. wakelock usage analysis a previous Community PDA project needs to keep the screen always bright when collecting user coordinates. In the face of things not involved, the network is the best learning tool, find the relevant information and find that powermanager can be used. wakelo
Android PowerManager BatteryManager, powermanager
PowerManager is used in the Android platform to manage and control the power status, restart, sleep status, and wake up of the device. Using this API will affect the battery standby time, so it is only necessary and generall
Basic Android tutorial-10.6 PowerManager (Power Service)
This section introduces:
This section describes the system services provided by Android --PowerManager), UsedManage CPU running, and the keyboard or screen is lit up; however, do not use this class unless necessary.After you use it, you must release it in time!
Http://hi-android.info/src/android/ OS /PowerManager.java.html
The powermanager class provides interfaces for Android power management. It is located in Android/OS/powermanager. java, But it implements few things. It mainly calls some lower-level (C/C ++) functions. for how
procedures for PowerManager and Wakelock
Transferred from: http://www.cnblogs.com/GnagWang/archive/2011/02/27/1966611.htmlPowerManager pm = (powermanager) getsystemservice (Context.power_service), via Context.getsystemservice (). method to get the PowerManager instance. The Wakelock instance is then generated by PowerManager's newwakelock (int flags, String tag)
Http://ubuntuforums.org/showthread.php? T = 284804
Howto disable screensaver and powermanager while mplayer or other apps are running
I
Have written a small Python daemon to disable gnome-screensaver and
Gnome-powermanager while certain specified apps are running.
It works quite well on Ubuntu edgy. It requires restart (> = 0.93 ),
Python-extract, and obviusly gnome-screensaver and gnome-
directory of your android system (in fact, the same principle as above, it is also a file called in the bin directory). I heard that most devices have the reboot and shutdown files. The available Android system does not have the shutdown file, so it cannot be used directly.
Runtime.getRuntime().exec(new String[]{"su","-c","shutdown"})
You can only run the following command to shut down the server (amazin
: powermanagerservice. The specific source code is located: frameworks/base/services/Java/COM/Android/Server/powermanagerservice. java. Android also provides the Android. OS. powermanager class on the top.
(Frameworks/base/CORE/Java/Android/OS/
program to open the window using type_system_alert, which is displayed on the top layer of all other programs (allows an application to open windows using the type type_system_alert, shown on top of all other applications .)
Android. Permission. vibrateAllows access to the vibrator)
Android. Permission. wake_lockAllow the use of wakelocks of powermanager to re
Android offline download knowledge, android offline
The offline download function is as follows:1. Download Management (START and cancel download ).2. Network judgment (wi-fi, 3G ).3. Independent process.4. timed and mobile phone reminders.5. self-starting.
Select the core method for offline downloadWhen the backend runs independently, we can easily think of services, but there are the following problems: (
. Permission. system_alert_windowAllows an application to open windows using the type type_system_alert, shown on top of all other applicationsAllow a program to open the window using type_system_alert, which is displayed on the top layer of all other programs
Android. Permission. vibrateAllows access to the vibratorAllow access to vibration Devices
Android. Permission. wake_lockAllows using
Android listens to screen lock/Open events, and android screen lock1. Two solutions
(1) Listen to BroadcastReceiver
(2) obtain the PowerManager event
2. BroadcastReceiver2.1. event
There are 3 events in total:
Intent. ACTION_SCREEN_ON: Intent. ACTION_SCREEN_OFF: Intent. ACTION_USER_PRESENT: unlocked
2.2. Permission
To unlock a listener, you must register the pe
the system/bin directory of your android system (in fact, the same principle as above, it is also a file called in the bin directory). I heard that most devices have the reboot and shutdown files. The available Android system does not have the shutdown file, so it cannot be used directly.
Runtime.getRuntime().exec(new String[]{"su","-c","shutdown"})
You can only run the following command to shut down the
default is the count mechanism. The difference between the two mechanisms is that the former, whether Acquire () How many times, just pass once release () can be unlocked. and The latter is really unlocked in the ( --count= = 0 ), the same time when (count = = 0) to apply for lock . SoPowermanager.wakelockThe counting mechanism is not a true sense of the request/release of each lock, it just the same lock was applied/released the number of times to be counted, and then to operate.
Sou
Android system is not shutdown files, so, can not directly use
Runtime.getruntime (). EXEC (new string[]{"Su", "-C", "Shutdown"})
You can only perform the following command to shutdown (good Magic p parameters)
Runtime.getruntime (). EXEC (new string[]{"Su", "-C", "Reboot-p"});
Four. PowerManager reboot and reflection call Powermanagerservice shutdown
1. PowerMana
This article describes the Android screen and the implementation of the quenching screen control method. Share to everyone for your reference, specific as follows:
I. Overview
Many of our Android apps need to work with a splash screen and an off screen, like an alarm clock, which needs to be lit and then extinguished. So today, we're going to analyze the function in this area.
Two. System service Powerma
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.