Note that there are some explanatory texts on larger screens.

plurals
  1. POMessage is not refreshing in Push Notification
    text
    copied!<p>My problem is that I am able to get notifications from server but the message which is coming from server is not refreshing in my mobile whatever notification is coming first time the same message I am getting all the time . Here is my code of C2DMMessageReceiver &amp; MessageReceivedActivity is as follows .</p> <pre><code> public class C2DMMessageReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.w("C2DM", "Message Receiver called"); if ("com.google.android.c2dm.intent.RECEIVE".equals(action)) { Log.w("C2DM", "Received message"); final String payload = intent.getStringExtra("payload"); createNotification(context, payload); } } public void createNotification(Context context, String payload) { NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, "Message received", System.currentTimeMillis()); // Hide the notification after its selected notification.flags |= Notification.FLAG_AUTO_CANCEL; Intent intent = new Intent(context, MessageReceivedActivity.class); intent.putExtra("payload", payload); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); notification.setLatestEventInfo(context, "Message", "New message received", pendingIntent); notificationManager.notify(0, notification); } } public class MessageReceivedActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_result); Bundle extras = getIntent().getExtras(); if (extras != null) { String message = extras.getString("payload"); if (message != null &amp;&amp; message.length() &gt; 0) { TextView view = (TextView) findViewById(R.id.result); view.setText(message); } } super.onCreate(savedInstanceState); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload