I'm developing an phonegap-based android app, and I'm writing code to handle notifications. Here is a snippet of the piece of code which is supposed to raise the notification:
Intent notificationIntent = new Intent(context, MainActivity.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent =
PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
I want to prepare the Intent so it opens the app in the page related to what the notification is about. So far, the only thing I have found related to this is the following line, placed in the MainActivity
class (the one which extends DroidGap
class), in the onCreate
method:
super.loadUrl("file:///android_asset/www/index.html", 10000);
but I would like to set that URL dynamically from the code above, or, in the worst (or best, I really dont know...) case, parametrize it and pass parameters to the onCreate method from the code above. How do I do that? Thanks in advance...