I have developed push notification in android/ios environment with worklight + AngularJs and I'm getting successful notification in both the platform.
My application having multiple HTML pages. whenever i click my received notification from notification bar it's redirect to default index.html page, but I want it to redirect any another (HTML) internal page. I also follow some LINK related to this issue but it show if we have code in single html file. but in my case I have multiple HTML and i don't know how to implement this scenario.
I know many of you found this as a repeat question, but i think this scenario is some what different.
Given below is my Broadcast notification code in main.js
function wlCommonInit(){
angular.element(document).ready(function() {
// Boot up
angular.bootstrap(document, ["myMobile"]);
});
WL.Client.connect({onSuccess: connectSuccess, onFailure: connectFailure});
}
function connectSuccess() {
WL.Logger.debug ("Successfully connected to MobileFirst Server.");
}
function connectFailure() {
WL.Logger.debug ("Failed connecting to MobileFirst Server.");
//1st snippet
WL.SimpleDialog.show("Push Notifications", "Failed connecting to MobileFirst Server. Try again later.",
[{
text : 'Reload',
handler : WL.Client.reloadapp
},
{
text: 'Close',
handler : function() {}
}]
);
}
//2nd snippet. For the 3rd one copy the adapter
//------------------------------- Handle received notification ---------------------------------------
WL.Client.Push.onMessage = function (props, payload) {
WL.SimpleDialog.show("Tag Notifications", "Provider notification data: " + JSON.stringify(props), [ {
text : 'Close',
handler : function() {
WL.SimpleDialog.show("Brodcast Notifications", "Application notification data: " + JSON.stringify(payload), [ {
text : 'Close',
handler : function() {}
}]);
}
}]);
};
Below code is my angularJS route.js:
angular.module('MyMobile').
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when("/login", {
templateUrl: "partials/login.html",
controller: "loginController"}
).
when("/home/:activePanelId", {
templateUrl: "partials/home.html",
controller: "homeController"}
).
when("/activity", {
templateUrl: "partials/home.html",
controller: "homeController",
activetab: "activity"}
).
when("/messages", {
templateUrl: "partials/home.html",
controller: "homeController",
activetab: "messages"}
).
when("/membership", {
templateUrl: "partials/membership.html",
controller: "membershipController"}
).
when("/documentrequest", {
templateUrl: "partials/documentRequest.html"/*,
controller: "documentRequestController"*/}
).
when("/findprovider", {
templateUrl: "partials/findProvider.html",
controller: "findProviderController"}
).
when("/benefitsearch", {
templateUrl: "partials/benefitSearch.html",
controller: "benefitController"}
).
when("/benefitsearchresults", {
templateUrl: "partials/benefitSearchResults.html",
controller: "benefitController"}
).
when("/medicine", {
templateUrl: "partials/medicine.html",
controller: "medicineController"}
).
when("/ehr", {
templateUrl: "partials/ehr.html",
controller: "ehrController"}
).
when("/preauthorization", {
templateUrl: "partials/preAuthorization.html",
controller: "preAuthorizationController"}
).
otherwise({redirectTo: '/login'});
}]);
Note: I want to redirect to "/messages", when i click Notification from notification bar.