Android how to show notification on screen

Create Notification using NotificationCompat.Builder NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) // notification icon .setContentTitle(“Notification!”) // title for notification .setContentText(“Hello word”) // message for notification .setAutoCancel(true); // clear notification after click Intent intent = new Intent(this, MainActivity.class); PendingIntent pi = PendingIntent.getActivity(this,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK); mBuilder.setContentIntent(pi); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(0, mBuilder.build()); Push Notification on locked Screen http://www.hongkiat.com/blog/android-lock-screen-notifications/

Media Session Compat not showing Lockscreen controls on Pre-Lollipop

While not strictly required for MediaSession, RemoteControlClient used on API14-19 devices, does require audio focus and it is 100% strongly recommended for all media playback. Adding lines such as: AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int result = audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); if (result != AudioManager.AUDIOFOCUS_GAIN) { return; //Failed to gain audio focus } Before playing any … Read more

Android activity over default lock screen

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); try using this flags to disable lock screen when the activity is started. After API level 17 you can use <activity android:name=”.yourActivityName” android:showOnLockScreen=”true” android:screenOrientation=”sensorPortrait” > showOnLockScreen like in the example…

Android Lock Screen Widget

Lock screen interaction is difficult. Android allows basic operations with two window flags (FLAG_SHOW_WHEN_LOCKED and FLAG_DISMISS_KEYGUARD). FLAG_SHOW_WHEN_LOCKED works pretty consistently in that it will show on top of the lock screen even when security is enabled (the security isn’t bypassed, you can’t switch to another non-FLAG_SHOW_WHEN_LOCKED window). If you’re just doing something temporary, like while … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)