I have receiving GCM push notification
message in my mobile successfully. But, I want to make some text update in my app working page.
While receiving push notification, app page automatically need to change text like push notification received and show to any text view, in working page.
Already referred: Updating the UI upon receiving an android push notification
For push notification
am using this class to receive notification
:
public class GCMBroadcastReceiver extends WakefulBroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
}
}
For MainPage Push notif text showing Activity Page Code:
public void onResume(){
super.onResume() ;
Log.v("tag","onResume working...") ;
broadcast = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getApplicationContext(), "Receiver...", 1).show();
}
};
LocalBroadcastManager.getInstance(this).registerReceiver(broadcast,new IntentFilter("com.google.android.c2dm.intent.REGISTRATION"));
}
@Override
protected void onPause() {
super.onPause();
LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcast);
}
My above code: exactly don't know the mistake in code..