List of usage examples for android.os PowerManager SCREEN_DIM_WAKE_LOCK
int SCREEN_DIM_WAKE_LOCK
To view the source code for android.os PowerManager SCREEN_DIM_WAKE_LOCK.
Click Source Link
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 ww w. j a v a2s.co 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: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 ww . ja v a 2s . 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.mobile.lapa.waitandsee.MyGcmListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param title// w w w .jav a 2s .c o m * @param message GCM message received. */ private void sendNotification(String title, String message) { Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("TITLE_KEY", title); intent.putExtra("MESSAGE_KEY", message); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.game_finished); //Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.sap_logo).setContentTitle(title).setContentText(message) .setAutoCancel(true).setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); // Random random = new Random(); // int notificationId = random.nextInt(9999 - 1000) + 1000; notificationManager.notify(0 /*notificationId*/, notificationBuilder.build()); // -------- Wake up the phone and show the main activity PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock mWakeLock = pm.newWakeLock( (PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "MainServiceTag"); mWakeLock.acquire(); // ------- Send notification to the android system startActivity(intent); mWakeLock.release(); }
From source file:com.android.screenspeak.controller.FullScreenReadControllerApp.java
@SuppressWarnings("deprecation") public FullScreenReadControllerApp(FeedbackController feedbackController, CursorController cursorController, ScreenSpeakService service) {/*from w ww . j a v a 2 s .c om*/ if (cursorController == null) throw new IllegalStateException(); if (feedbackController == null) throw new IllegalStateException(); mCursorController = cursorController; mFeedbackController = feedbackController; mService = service; mWakeLock = ((PowerManager) service.getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); }
From source file:com.android.talkback.controller.FullScreenReadControllerApp.java
@SuppressWarnings("deprecation") public FullScreenReadControllerApp(FeedbackController feedbackController, CursorController cursorController, TalkBackService service) {//from w w w. j a v a 2s.c o m if (cursorController == null) throw new IllegalStateException(); if (feedbackController == null) throw new IllegalStateException(); mCursorController = cursorController; mFeedbackController = feedbackController; mService = service; mWakeLock = ((PowerManager) service.getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); }
From source file:com.google.android.marvin.mytalkback.FullScreenReadController.java
@SuppressWarnings("deprecation") public FullScreenReadController(TalkBackService service) { mService = service;/* w ww . j a v a2s .com*/ mSpeechController = service.getSpeechController(); mCursorController = service.getCursorController(); mFeedbackController = MappedFeedbackController.getInstance(); final PowerManager pm = (PowerManager) service.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); setReadingState(AutomaticReadingState.STOPPED); }
From source file:net.majorkernelpanic.spydroid.SpydroidActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/*from w w w . ja v a2 s. c o m*/ camera = (SurfaceView) findViewById(R.id.smallcameraview); context = this.getApplicationContext(); line1 = (TextView) findViewById(R.id.line1); line2 = (TextView) findViewById(R.id.line2); version = (TextView) findViewById(R.id.version); buttonSettings = (ImageView) findViewById(R.id.button_settings); buttonClient = (ImageView) findViewById(R.id.button_client); buttonAbout = (ImageView) findViewById(R.id.button_about); signWifi = (TextView) findViewById(R.id.advice); signStreaming = (TextView) findViewById(R.id.streaming); signInformation = (LinearLayout) findViewById(R.id.information); pulseAnimation = AnimationUtils.loadAnimation(this, R.anim.pulse); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); H264Stream.setPreferences(settings); settings.registerOnSharedPreferenceChangeListener(this); camera.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder = camera.getHolder(); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "net.majorkernelpanic.spydroid.wakelock"); // Print version number try { version.setText("v" + this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName); } catch (Exception e) { version.setText("v???"); } Session.setSurfaceHolder(holder); Session.setHandler(handler); Session.setDefaultAudioEncoder(settings.getBoolean("stream_audio", false) ? Integer.parseInt(settings.getString("audio_encoder", "3")) : 0); Session.setDefaultVideoEncoder(settings.getBoolean("stream_video", true) ? Integer.parseInt(settings.getString("video_encoder", "2")) : 0); Session.setDefaultVideoQuality(new VideoQuality(settings.getInt("video_resX", 0), settings.getInt("video_resY", 0), Integer.parseInt(settings.getString("video_framerate", "0")), Integer.parseInt(settings.getString("video_bitrate", "0")) * 1000)); rtspServer = new RtspServer(8086, handler); httpServer = new CustomHttpServer(8080, this.getApplicationContext(), handler); buttonSettings.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Starts QualityListActivity where user can change the quality of the stream Intent intent = new Intent(context, OptionsActivity.class); startActivityForResult(intent, 0); } }); buttonClient.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Starts ClientActivity, the user can then capture the stream from another phone running Spydroid Intent intent = new Intent(context, ClientActivity.class); startActivityForResult(intent, 0); } }); buttonAbout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Display some information Intent intent = new Intent(context, AboutActivity.class); startActivityForResult(intent, 0); } }); }
From source file:com.metinkale.prayerapp.vakit.AlarmReceiver.java
@Override protected void onHandleIntent(Intent intent) { PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "AlarmReceiver"); wakeLock.acquire();/* w w w .j a v a 2 s . com*/ try { fireAlarm(intent); } catch (Exception e) { Crashlytics.logException(e); } wakeLock.release(); if (NotificationPopup.instance != null && Prefs.showNotificationScreen()) { NotificationPopup.instance.finish(); } Times.setAlarms(); }