1. App-side configuration
A. Allow use of third-party plugins:
Open the app's Manifest.json file, switch to a visual view, and allow the use of third-party plugins.
B, configure the third-party plug-in (a push)
Add a push node under the permission node in the app's Manifest.json file:
"Push": {"description": "Manage push message plug-in"},
If it already exists, do not change it.
To add a push node under the Plus-->distribute-->plugins node
"Push": {"description": "Manage message push capability", "Cover": "false", "Igexin": {"AppID": "", "Appkey": "", "Appsecret": ""}},
The above AppID, Appkey, and Appsecret are all added after the app has been registered on a Twitter site.
C. Bind events that receive push messages
Document.addeventlistener ("Plusready", function () { message = document.getElementById ("message"); Listen for click Message Event plus.push.addEventListener ("click", Function (msg) {/* * * * * * * * as required ), false); Listen for online message event Plus.push.addEventListener ("Receive", Function (msg) {/ * * * * * as required * * }, False);}, False);
2, a push website registration
Follow the prompts to register and add the app, and then, as shown below, click on the app configuration to view AppID, Appkey, etc., and enter it in the app profile location. When the app is opened online, if the number of users on the page is displayed as 1, the communication between the push and app is successful.
Click Create push to push messages for the app.
Note: The app needs to be packaged and then installed on the phone, otherwise the app's AppID parameters are not parameters configured in the configuration file, but hbuilder the parameters of the real Machine debug base, which will result in a push-to-app connection unsuccessful.
Hbuilder Development app uses push-to-send messages