List of usage examples for android.os PowerManager ON_AFTER_RELEASE
int ON_AFTER_RELEASE
To view the source code for android.os PowerManager ON_AFTER_RELEASE.
Click Source Link
From source file:Main.java
public static void acquire(Context context) { if (wakeLock != null) wakeLock.release();// w w w. j av a 2 s.co m PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock( PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "WakeLock"); wakeLock.acquire(); }
From source file:Main.java
public static void acquireTemporaryWakelocks(Context context, long timeout) { if (wakeLock == null) { PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "PushSMS"); }/* www . j a va2 s.c o m*/ wakeLock.acquire(timeout); if (wifiLock == null) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); wifiLock = wifiManager.createWifiLock("PushSMS"); } wifiLock.acquire(); new Handler().postDelayed(new Runnable() { @Override public void run() { wifiLock.release(); } }, timeout); }
From source file:Main.java
/** * Show the activity over the lockscreen and wake up the device. If you * launched the app manually both of these conditions are already true. If * you deployed from the IDE, however, this will save you from hundreds of * power button presses and pattern swiping per day! *//*from w ww . j a v a2 s . c o m*/ public static void riseAndShine(Activity activity) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); PowerManager power = (PowerManager) activity.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock lock = power.newWakeLock( PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "wakeup!"); lock.acquire(); lock.release(); }
From source file:com.almarsoft.GroundhogReader.lib.MessagePosterLib.java
public MessagePosterLib(String currentGroup, String groups, String body, String subject, String references, String prevMsgId, Context context) { mCurrentGroup = currentGroup;/*from ww w .ja v a 2 s.co m*/ mContext = context; mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext); mGroups = groups.trim(); mBody = body; mSubject = subject.trim(); mPostCharset = mPrefs.getString("postCharset", "ISO8859_15"); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "GroundhogSending"); // Reply to non-first post in a thread if (references != null && references.length() > 0) mReferences = references.trim(); else mReferences = null; // Reply to a thread if (prevMsgId != null && prevMsgId.length() > 0) mPrevMsgId = prevMsgId.trim(); else mPrevMsgId = null; // Message starting new thread // Reply to the first post in thread if (mReferences == null && mPrevMsgId != null) { mReferences = mPrevMsgId; } }
From source file:com.github.sryze.wirebug.DebugStatusService.java
@Override public void onCreate() { super.onCreate(); Log.d(TAG, "Service is created"); preferences = PreferenceManager.getDefaultSharedPreferences(this); PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); }
From source file:cm.aptoide.pt.DownloadQueueService.java
@Override public void onCreate() { super.onCreate(); notifications = new HashMap<Integer, HashMap<String, String>>(); PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); keepScreenOn = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "Full Power"); Log.d("Aptoide-DowloadQueueService", "Created"); }
From source file:com.TwentyCodes.android.IOIOTruck.CameraActivity.java
/** * Called when the activity is resuming/*from w w w.j a v a 2 s . c o m*/ * (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onResume() */ @Override protected void onResume() { PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); mWakeLock.acquire(); super.onResume(); }
From source file:com.volosyukivan.WiFiInputMethod.java
@Override public void onCreate() { super.onCreate(); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "wifikeyboard"); // Debug.d("WiFiInputMethod started"); serviceConnection = new ServiceConnection() { //@Override public void onServiceConnected(ComponentName name, IBinder service) { // Debug.d("WiFiInputMethod connected to HttpService."); try { remoteKeyboard = RemoteKeyboard.Stub.asInterface(service); keyboardListener = new RemoteKeyListener.Stub() { @Override//from w w w .j a v a2 s . c om public void keyEvent(int code, boolean pressed) throws RemoteException { // Debug.d("got key in WiFiInputMethod"); receivedKey(code, pressed); } @Override public void charEvent(int code) throws RemoteException { // Debug.d("got key in WiFiInputMethod"); receivedChar(code); } @Override public boolean setText(String text) throws RemoteException { return WiFiInputMethod.this.setText(text); } @Override public String getText() throws RemoteException { return WiFiInputMethod.this.getText(); } }; RemoteKeyboard.Stub.asInterface(service).registerKeyListener(keyboardListener); } catch (RemoteException e) { throw new RuntimeException("WiFiInputMethod failed to connected to HttpService.", e); } } //@Override public void onServiceDisconnected(ComponentName name) { // Debug.d("WiFiInputMethod disconnected from HttpService."); } }; if (this.bindService(new Intent(this, HttpService.class), serviceConnection, BIND_AUTO_CREATE) == false) { throw new RuntimeException("failed to connect to HttpService"); } }
From source file:cx.ring.fragments.CallFragment.java
@Override public void onCreate(Bundle savedBundle) { Log.i(TAG, "onCreate"); super.onCreate(savedBundle); audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); setHasOptionsMenu(true);/*from w w w .ja v a2s. co m*/ PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); mScreenWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "cx.ring.onIncomingCall"); mScreenWakeLock.setReferenceCounted(false); Log.d(TAG, "Acquire wake up lock"); if (mScreenWakeLock != null && !mScreenWakeLock.isHeld()) { mScreenWakeLock.acquire(); } }
From source file:com.google.android.marvin.mytalkback.ProcessorVolumeStream.java
@SuppressWarnings("deprecation") public ProcessorVolumeStream(TalkBackService service) { mContext = service;/* w ww. j a va2 s . c o m*/ mAudioManager = (AudioManager) service.getSystemService(Context.AUDIO_SERVICE); mCursorController = service.getCursorController(); mLongPressHandler = new LongPressHandler(this); final PowerManager pm = (PowerManager) service.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, WL_TAG); }