Advertisement
Ankhwatcher

Notification

Apr 6th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. Start:
  2.  
  3. Builder nCompatBuilder = new NotificationCompat.Builder(this);
  4.         nCompatBuilder.setAutoCancel(false);
  5.         nCompatBuilder.setOngoing(true);
  6.         nCompatBuilder.setContentTitle(getString(R.string.app_name));
  7.         nCompatBuilder.setContentText(contentText);
  8.         nCompatBuilder.setContentIntent(contentIntent);
  9.  
  10.         nCompatBuilder.setSmallIcon(R.drawable.ic_menu_capture);
  11.  
  12.         Notification notification = nCompatBuilder.getNotification();
  13.  
  14.         notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  15.         notificationManager.notify(CAPTURING_ROUTE, notification);
  16.  
  17. Stop:
  18.  
  19. notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  20.         notificationManager.cancel(CAPTURING_ROUTE);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement