Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onNotificationPosted(StatusBarNotification sbn) {
- if (sbn.getId() != 12321) {
- this.cancelAllNotifications();
- }
- NotificationManager mNotificationManager =
- (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- if(!PhoneStateManager.getInstance().isDesconectado())
- return;
- AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
- cancelAllNotifications();
- Intent i = new Intent();
- PendingIntent mBlankIntent=PendingIntent.getActivity(getBaseContext(), 0, i,PendingIntent.FLAG_UPDATE_CURRENT);
- if (sbn.getId() != 12321) {
- mNotificationManager.notify(12321, new Notification.Builder(this)
- .setContentTitle("").setContentText("")
- .setSmallIcon(R.drawable.transparent)
- .setPriority(Notification.PRIORITY_HIGH)
- .setFullScreenIntent(mBlankIntent, false)
- .setAutoCancel(true)
- .build());
- mNotificationManager.cancel(12321);
- mNotificationManager.cancelAll();
- }
- Intent closeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- sendBroadcast(closeIntent);
- }
Add Comment
Please, Sign In to add comment