1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
//texte dans la bar de notification
CharSequence contentTitle = "Notification serveur tombé";
int icon = R.drawable.adexos;
long when = System.currentTimeMillis();
contentText = "Serveur: "+ipServ.getNom()+" "+ipServ.getCountfails()+"eme essai";
Intent notificationIntent = new Intent(_context,Accueil.class);
notificationIntent.setClassName("com.adexos.android.composants", "com.adexos.android.composants.gui.accueil");
Notification notification = new Notification(icon, contentTitle, when);
PendingIntent contentIntent = PendingIntent.getActivity(_context, 0, notificationIntent, 0);
notification.setLatestEventInfo(_context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(1,notification); |
Partager