Android Notification - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Notification class.

This code example shows how to use the following methods: setLatestEventInfo
	    NotificationManager manger = (NotificationManager) context
	            .getSystemService(context.NOTIFICATION_SERVICE);
 
		Intent mainIntent = new Intent("ti.intent.action.calendar.ALARM");
 
	    Notification notification = new Notification(0x7f020000,
	            "", System.currentTimeMillis());
	    PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
	            mainIntent, 0);
	//TEST 
		notification.setLatestEventInfo(context,"Payment Reminder","Send me to jhaynie@appcelerator.com",contentIntent);
	    manger.notify(1, notification);
	} 
} 
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
This code example shows how to use the following methods: setLatestEventInfo
@RunWith(TestRunners.WithDefaults.class) 
public class NotificationTest { 
  @Test 
  public void setLatestEventInfo__shouldCaptureContentIntent() throws Exception { 
    PendingIntent pendingIntent = PendingIntent.getActivity(new Activity(), 0, new Intent(), 0);
    Notification notification = new Notification();
    notification.setLatestEventInfo(new Activity(), "title", "content", pendingIntent);
    assertSame(pendingIntent, notification.contentIntent);
  } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
	    NotificationManager manger = (NotificationManager) context
	            .getSystemService(context.NOTIFICATION_SERVICE);
 
		Intent mainIntent = new Intent("ti.intent.action.calendar.ALARM");
 
	    Notification notification = new Notification(0x7f020000,
	            "", System.currentTimeMillis());
	    PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
	            mainIntent, 0);
	//TEST 
		notification.setLatestEventInfo(context,"Payment Reminder","Send me to jhaynie@appcelerator.com",contentIntent);
	    manger.notify(1, notification);
	} 
} 
 
Full Snippet Info
-307
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
@RunWith(TestRunners.WithDefaults.class) 
public class NotificationTest { 
    @Test 
    public void setLatestEventInfo__shouldCaptureContentIntent() throws Exception { 
        PendingIntent pendingIntent = PendingIntent.getActivity(new Activity(), 0, new Intent(), 0);
        Notification notification = new Notification();
        notification.setLatestEventInfo(new Activity(), "title", "content", pendingIntent);
        assertSame(pendingIntent, notification.contentIntent);
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
            n.contentView.setTextViewText(viewIds.info, "");
            return progressNotification;
        } 
 
        private ProgressNotification generatePreICS(OpNotification opn, int layout, TextViewIds viewIds) {
            Notification n = new Notification(opn.getDrawable(), opn.getTickerText(), currentTimeMillis());
 
            n.contentView = new RemoteViews(context.getApplicationContext().getPackageName(), layout);
 
            notificationStyles.getTitleAppearance().setOn(n.contentView, viewIds.title);
            StatusBarNotificationStyles.TextAppearance textAppearance = notificationStyles.getTextAppearance();
            textAppearance.setOn(n.contentView, viewIds.text);
            textAppearance.setOn(n.contentView, viewIds.info);
 
            n.contentView.setTextViewText(viewIds.title, opn.getEventTitle());
            n.contentView.setTextViewText(viewIds.text, opn.getEventDetail());
            n.contentView.setProgressBar(android.R.id.progress, 1, 0, true);
            return new ProgressNotification(n, viewIds);
        } 
 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
     * @param icon The id of a drawable to be used as the small icon. Will display on all platforms. 
     * @param thumb A bitmap representing the currently playing item. Ignored on lower API levels. 
     * @return 
     */ 
    public Notification build(String title, String text, int icon, Bitmap thumb) {
        Notification notification = new Notification(icon, title, System.currentTimeMillis());
        notification.setLatestEventInfo(mContext, title, text, mIntent);
        return finalize(notification);
    } 
 
    /** 
     * Perform modifications to a notification that apply to all API levels. All definitions of 
     * buildNotification should call this before returning. 
     */ 
    protected Notification finalize(Notification notification) {
        notification.flags |= Notification.FLAG_ONGOING_EVENT;
        return notification;
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
Context c = getActivity();
		if (c == null) {
			c = TiApplication.getInstance().getApplicationContext();
		} 
		notification.setLatestEventInfo(c, contentTitle, contentText, contentIntent.getPendingIntent());
	} 
 
	public Notification getNotification()
	{  
		return notification;
	} 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
  } 
 
  ConfirmationStrategy buildPreInstallConfirmationStrategy() { 
//    return(new ImmediateConfirmationStrategy()); 
    Notification n=
        new Notification(android.R.drawable.stat_notify_chat,
                         "Update ready to install", System.currentTimeMillis());
 
    n.setLatestEventInfo(this, "Update Ready to Install",
                         "Click to install the update!", null); 
    n.flags|=Notification.FLAG_AUTO_CANCEL;
 
    return(new NotificationConfirmationStrategy(n));
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLatestEventInfo
        this.promptNotificationId = completionNotificationId + 1;
        notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
    } 
 
    public Notification createNotificationWith(OpNotification opn) {
        Notification n = new Notification(opn.getDrawable(), opn.getTickerText(), currentTimeMillis());
        n.setLatestEventInfo(context, opn.getEventTitle(), opn.getEventDetail(), manageGitRepo);
        return n;
    } 
 
    public void cancelOngoingNotification() { 
        notificationManager.cancel(ongoingOpNotificationId);
    } 
 
    public void clearPromptNotification() { 
        notificationManager.cancel(promptNotificationId);
    } 
 
    public void notifyPromptWith(OpNotification opNotification) {
        Notification n = createNotificationWith(opNotification);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Notification Questions & Answers:

Other Android Notification Examples

23:	    // Build notification
24:	    // Actions are just fake
25:	    Notification noti = new Notification.Builder(this)
26:	        .setContentTitle("New mail from " + "test@gmail.com")
27:	        .setContentText("Subject").setSmallIcon(R.drawable.icon)

Read More

92:	        NotificationManager notificationManager = (NotificationManager)
93:	                context.getSystemService(Context.NOTIFICATION_SERVICE);
94:	        Notification notification = new Notification(icon, message, when);
95:	        
96:	        String title = context.getString(R.string.app_name);
-
92:	        NotificationManager notificationManager = (NotificationManager)
93:	                context.getSystemService(Context.NOTIFICATION_SERVICE);
94:	        Notification notification = new Notification(icon, message, when);
95:	        
96:	        String title = context.getString(R.string.app_name);

Read More

See Code Examples for Android Notification Methods: