After clicking a pushed notification and app is reopened (back click, which closes the app, and then re-opening app) then it gets the intent from getIntent()
and does the things its supposed to do when coming from a notification.
If I push a notification and close app and reinstall the app (while working in debug mode with Eclipse) to run again it runs as if it was the first time, but if I close the app and then open it again it still has the intent from before (that came from the notification).
How do I clear the getIntent()
after it's been used? And why is it, after closing the app, still 'active'?
Receiver
public class Receiver extends ParsePushBroadcastReceiver {
@Override
public void onPushOpen( Context context, Intent intent ) {
Intent i = new Intent( context, Main.class );
i.putExtras( intent.getExtras() );
i.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
context.startActivity( i );
ParseAnalytics.trackAppOpened( intent );
}
}
Main Activity
@Override
protected void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
try {
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String jsonData = extras.getString( "com.parse.Data" );
JSONObject jObj = new JSONObject( jsonData );
Log.e(TAG, "Intent extras: " + jObj.get( "data" ).toString();
} catch ( Exception e ) { /* Nom nom nom */ }
.... other code
}