This article tests Jpush to push the message to the mobile phone side, the mobile phone side clicks the notification bar, can see the specific push content.
1. Aurora Push Message Settings
To set additional fields:
Click Send to receive a message notification on the phone.
2. Notification of messages received by the mobile phone
Click to go to the specific page
Specific code settings:
3. Set up Aurora Service and message receiving interface:
Launch Aurora Push Service
Window.plugins.jPushPlugin.init ();
Receive messages and jump to corresponding pages
Window.plugins.jPushPlugin.openNotificationInAndroidCallback = function (data)
{
var obj = json.parse (data);
var idvalue = obj.extras[' Cn.jpush.android.EXTRA '].id;//corresponds to Aurora push: The key name of the additional field
var alert = obj.extras[' Cn.jpush.android.ALERT '];
$state. Go (' message ', {id:idvalue + alert});
};
4.message.html page Content
<ion-view>
<ion-nav-title>
Message content
</ion-nav-title>
<ion-nav-buttons side= "Left" >
<a class= "button Button-icon ion-ios-arrow-back" ng-click= "Toclose ()" ></a>
</ion-nav-buttons>
<ion-content class= "padding" >
{{Message}}
</ion-content>
</ion-view>
5.message.html corresponding to the Contoller
Angular.module ("Ionicapp.controllers")
. Controller ("Messagecontroller", [' $scope ', ' $stateParams ', function ($scope, $stateParams)
{
var id = $stateParams. id;
$scope. message= ' message ID: ' +id;
}]);
6. Path settings
{
Name : ' message ',
Value: {
URL: "/message/:id/",
Templateurl: "Templates/base/message.html",
Controller: "Messagecontroller"
}
}
Conclusion: The expected effect is basically achieved, and the application of the content should be further researched.
Jpush message push and content display under Ionic