|

楼主 |
发表于 2018-8-1 10:25:05
|
显示全部楼层
- var Model = function() {
- this.callParent();
- };
- Model.prototype.modelLoad = function(event) {
- document.addEventListener("deviceready", onDeviceReady, false);
- };
- Model.prototype.button1Click = function(event) {
-
- };
- var onDeviceReady = function() {
- document.addEventListener("jpush.receiveRegistrationId", function(event) {
- alert("receiveRegistrationId" + JSON.stringify(event));
- }, false)
- initiateUI();
- };
- var initiateUI = function() {
- try {
- window.JPush.init();
- window.JPush.setDebugMode(true);
- window.setTimeout(getRegistrationID, 1000);
- if (device.platform != "Android") {
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- } catch (exception) {
- console.log(exception);
- }
- };
- var getRegistrationID = function() {
- window.JPush.getRegistrationID(onGetRegistrationID);
- };
- var onGetRegistrationID = function(data) {
- try {
- console.log("JPushPlugin:registrationID is " + data);
- if (data.length == 0) {
- var t1 = window.setTimeout(getRegistrationID, 1000);
- }
- } catch (exception) {
- console.log(exception);
- }
- };
复制代码 |
|