Created
April 29, 2013 15:21
-
-
Save jcarlos7121/5482294 to your computer and use it in GitHub Desktop.
Notifications 2.3.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("deprecation") | |
private void generateNotification(Context arg0, String hola) { | |
// TODO Auto-generated method stub | |
int icon = R.drawable.ic_launcher; | |
long when = System.currentTimeMillis(); | |
NotificationManager notificationManager = (NotificationManager) | |
arg0.getSystemService(Context.NOTIFICATION_SERVICE); | |
Notification notification = new Notification(icon, hola, when); | |
String title = arg0.getString(R.string.app_name); | |
Intent notificationIntent = new Intent(arg0, ChatIndex.class); | |
// set intent so it does not start a new activity | |
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | | |
Intent.FLAG_ACTIVITY_SINGLE_TOP); | |
PendingIntent intent = | |
PendingIntent.getActivity(arg0, 0, notificationIntent, 0); | |
notification.setLatestEventInfo(arg0, title, hola, intent); | |
notification.flags |= Notification.FLAG_AUTO_CANCEL; | |
notificationManager.notify(0, notification); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment