Skip to content

Instantly share code, notes, and snippets.

@jeserkin
Created March 26, 2012 22:42
Show Gist options
  • Save jeserkin/2210346 to your computer and use it in GitHub Desktop.
Save jeserkin/2210346 to your computer and use it in GitHub Desktop.
Notification in android environment
NotificationManager nm = ( NotificationManager ) getSystemService( NOTIFICATION_SERVICE );
Notification notify = new Notification( android.R.drawable.stat_notify_more, "30 seconds ago you did something special and now it is over", ( System.currentTimeMillis() + 30000 ) );
Context context = QuizManager.this;
String title = "You were notified!";
String details = "You were notified about something!";
Intent intent = new Intent( context, QuizManager.class );
PendingIntent pi = PendingIntent.getActivity( context, 0, intent, 0 );
notify.setLatestEventInfo( context, title, details, pi );
nm.notify( 0, notify );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment