Iam using push notification to show notification. Its working fine by Alternate Entry point. Background application will listen for notifications. When I click on a notification, I want to open a specific page on my UI application. How is it done? I tried using the following code, but it will alway load the Ui from the starting page. How can I load a specific page if the app is already running. Else load the UI from the begining page. Also I want to pass some values from the Background app to the UI Application.
try {
ApplicationDescriptor[] appDescriptors =
CodeModuleManager.getApplicationDescriptors(CodeModuleManager.getModuleHandle("MYAPP"));
ApplicationDescriptor appDescriptor =
new ApplicationDescriptor(appDescriptors[0], new String[] {"MYAPP"});
ApplicationManager.getApplicationManager().runApplication(appDescriptor);
} catch (ApplicationManagerException e) {
e.printStackTrace();
}
You are already transferring data from the background to the main UI Application (the string
"MYAPP").Your application (the one listed in your previous question) starts up, and checks the arguments passed to it, and then determines whether to run in the background, or as a normal UI Application.
You can just add more arguments. In the code above, change it to something like this:
Then, in your
UiApplicationsubclass (e.g. in App.java), you can change it to… where I’ve added the
setNumberOfNotificationsReceived()method and theApp(String)constructor in yourAppclass. Those are just examples. Make them whatever you want.App.java: