I am trying to open an app when a push notification is received.
Code:
public class GCMIntentService extends GCMBaseIntentService {
public GCMIntentService() {
super("GCMIntentService");
}
@Override
protected void onMessage(Context context, Intent intent) {
Intent dialogIntent = new Intent(this, MyActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(dialogIntent);
}
}
This is what I have so far. But I cannot figure out what MyActivity.class is.
Let's say I want to start the app and that's it. I do not want to add another activity to the AndroidManifest.xml.
Can't I simply use MainActivity.class for Cordova?
What exactly is MyActivity.class?
PackageManager.getLaunchIntentForPackage can help you find the entry activity.
Its the class that implements the activity you wish to launch. LoginActivity, MainActivity, whatever it was you named it.
public void getnotification(View view) {