Jpush message push and content display under Ionic

Source: Internet
Author: User



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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.