private static void launchActivity(String message, String payload) { TiApplication appContext = TiApplication.getInstance(); // We need to get the class name for the main application activity. That isn't a problem if // we were started from the home screen of the device. However, if we were started as part // of the Push Service startup then the main activity may not have been started yet. So, we // make use of the PackageManager to provide the information that we need to start the main // activity. PackageManager pm = appContext.getPackageManager(); Intent launch = pm.getLaunchIntentForPackage(appContext.getPackageName()); // We still need to set the category and flags before we try to start the activity launch.addCategory(Intent.CATEGORY_LAUNCHER); launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Set the extras to the message and payload so that they are picked up on relaunch of the // activity launch.putExtra("message", message); launch.putExtra("payload", payload); appContext.startActivity(launch); }