List of usage examples for android.support.v4.app NotificationManagerCompat from
public static NotificationManagerCompat from(Context context)
From source file:com.ezhuk.wear.NotificationUtils.java
private static void showNotificationWithStyle(Context context, int id, NotificationCompat.Style style) { NotificationManagerCompat.from(context).notify(id, new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher).setStyle(style).build()); }
From source file:com.commonsware.android.wearactions.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationManagerCompat mgr = NotificationManagerCompat.from(this); NotificationCompat.Builder normal = buildNormal(); NotificationCompat.Action.Builder wearActionBuilder = new NotificationCompat.Action.Builder( android.R.drawable.ic_media_pause, getString(R.string.pause), buildPendingIntent(Settings.ACTION_DATE_SETTINGS)); NotificationCompat.Builder extended = new NotificationCompat.WearableExtender() .addAction(wearActionBuilder.build()).extend(normal); mgr.notify(NOTIFY_ID, extended.build()); finish();//from w ww. j a va2 s .c o m }
From source file:com.commonsware.android.pages.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationManagerCompat mgr = NotificationManagerCompat.from(this); NotificationCompat.Builder normal = buildNormal(); NotificationCompat.InboxStyle big = new NotificationCompat.InboxStyle(); big.setSummaryText(getString(R.string.summary)).addLine(getString(R.string.entry)) .addLine(getString(R.string.another_entry)).addLine(getString(R.string.third_entry)) .addLine(getString(R.string.yet_another_entry)).addLine(getString(R.string.low)); NotificationCompat.Builder bigPage = new NotificationCompat.Builder(this).setStyle(big); NotificationCompat.Builder twoPages = new NotificationCompat.WearableExtender().addPage(bigPage.build()) .extend(normal);/*from ww w . j a v a2s .com*/ mgr.notify(NOTIFY_ID, twoPages.build()); finish(); }
From source file:com.android.tripgenie.auto.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive called"); int conversationId = intent.getIntExtra(CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat.from(context).cancel(conversationId); }/*from w w w . j a va 2 s. c o m*/ }
From source file:com.commonsware.android.lollipopnotify.AlarmReceiver.java
@Override public void onReceive(Context ctxt, Intent i) { NotificationManagerCompat mgr = NotificationManagerCompat.from(ctxt); switch (i.getIntExtra(EXTRA_TYPE, -1)) { case 0:/*from w w w .j a va 2 s .co m*/ notifyPrivate(ctxt, mgr); break; case 1: notifyPublic(ctxt, mgr); break; case 2: notifySecret(ctxt, mgr); break; case 3: notifyHeadsUp(ctxt, mgr); break; } }
From source file:br.com.virtz.www.cfcmob.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (MyMessagingService.READ_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.cancel(conversationId); }//from www.j a va 2s. com } }
From source file:com.secupwn.aimsicd.utils.MiscUtils.java
public static void showNotification(Context context, String tickertext, String contentText, @DrawableRes int drawable_id, boolean auto_cancel) { int NOTIFICATION_ID = 1; Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_FROM_BACKGROUND); PendingIntent contentIntent = PendingIntent.getActivity(context, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), drawable_id); Notification notification = new NotificationCompat.Builder(context).setSmallIcon(drawable_id) .setLargeIcon(largeIcon).setTicker(tickertext) .setContentTitle(context.getResources().getString(R.string.main_app_name)) .setContentText(contentText).setOngoing(true).setAutoCancel(auto_cancel) .setContentIntent(contentIntent).build(); NotificationManagerCompat.from(context).notify(NOTIFICATION_ID, notification); }
From source file:com.example.android.recipeassistant.RecipeService.java
@Override public void onCreate() { mNotificationManager = NotificationManagerCompat.from(this); }
From source file:mycroft.ai.mycroftcore_android.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (MycroftMessagingService.READ_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MycroftMessagingService.CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.cancel(conversationId); }//w w w . j a va 2s . c o m } }
From source file:cl.chihau.holaauto.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive called"); if (MyMessagingService.READ_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.cancel(conversationId); }// www.j av a 2 s. co m } }