Bonjour
c'est encore moi et le push!!!!!!!!!!
j'arrive à envoyer et a recevoir des message push mais j'ai un petit problème pour le message, il ne change pas.
la reception du push
l'activité d'après
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 private void receptionMessage(Context context,Intent intent) { //recuperation de l'intent String message = intent.getStringExtra("message"); String type = intent.getStringExtra("type"); String titre=""; int icone = R.drawable.icon; //creation de la notification NotificationManager notifMan = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notif = new Notification(icone, message, System.currentTimeMillis()); //specification de l'activité à démarer lors du click Intent notifintent = new Intent(context, RootPushActivity.class); notifintent.putExtra("message", message); PendingIntent contenuIntent = PendingIntent.getActivity(context, 0, notifintent, 0); //affichage de la notification notif.setLatestEventInfo(context, titre, message, contenuIntent); // effacement après un clic dessus notif.flags |= Notification.FLAG_AUTO_CANCEL; //lancement de la notification notifMan.notify(1,notif); RootPushUtils.playNotificationSound(context); }
j'arrive pas à comprendre pourquoi si quelqu'un a une idée je suis preneur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 public class RootPushActivity extends Activity { TextView message; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainpush); message =(TextView)findViewById(R.id.push_text_message); } @Override protected void onResume() { Intent in = this.getIntent(); String mess = in.getStringExtra("message"); message.setText(mess); super.onResume(); } }
Partager