Cross-platform Mobile development Phonegap/cordova 3.3 Full series tutorial-Baidu Cloud push push

Source: Internet
Author: User

message push-Baidu push

Choose Baidu Cloud Push reason: professional, stable, free (Google GCM in the country sometimes can not use the normal)

Open the URL, register the developer account, log in.

http://developer.baidu.com/bae/








Here the API key and secret key to use, you can first copy to Notepad to spare.





Download, install the APK client on your phone and open pushdemo.

Then test the push message in Dev Center


At this point the mobile phone will receive a push message


How to integrate into Phonegap/cordova

Add plugin Cordova plugin add com.cmpsoft.mobile.plugin.pushnotification

Compiling Cordova build Android

When the compilation is complete, open with ADT (Eclipse)

Copy apikey at Baidu Developer Center



Add the following code to the HTML page:

Fastgopushnotification.init ("Apikey");

Select Apikey, Paste.


Perform debugging


At this point you can use the developer center and push a message to test


You should be able to receive push messages on the emulator at this time.


Note: This plugin has no way to send for one or more clients, so it is necessary to encapsulate the channel_id and user_id on the phone side.

Modify source file Pushnotification.java


Modify the Sendpushinfo method,


To modify the Pushnotification.js file and to increase the method of receiving channel_id and user_id, please refer to the Official document or Device.js plugin.

Results



Service-Side Erection

Open download Baidu Cloud push service side (the current version of C #, to PHP and JSP, Python friends from here to download http://developer.baidu.com/wiki/index.php?title=docs/cplat/push/ SDK/SERVERSDK).

C # version Https://github.com/xiariqingquan/BaiduPushAspxServer

Open with Visual Studio and debug


1. Copy Apikey and Secretkey in the developer Center

2. Enter notification title and content

3, send the message.

To more features of their own packaging, hands-on ability to gradually achieve success!


SOURCE download


Exchange please add QQ Group: 166691882 (this group just built)


for Programmer Health Care 18136761128 (the cervical spine, sedentary guidance to chronic diseases, has been on CCTV, fake a penalty ten)

Cross-platform Mobile development Phonegap/cordova 3.3 Full series tutorial-Baidu Cloud push push

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.