add getRegistragionID

This commit is contained in:
zhangqinhghe
2014-06-12 11:02:33 +08:00
parent 265415f50e
commit 121d63b635
3 changed files with 74 additions and 35 deletions
+33 -16
View File
@@ -10,14 +10,14 @@ JPushPlugin.prototype.error_callback = function(msg){
console.log("Javascript Callback Error: " + msg)
}
JPushPlugin.prototype.call_native = function(name, args, callback){
JPushPlugin.prototype.call_native = function(name, args, callback){
console.log("start JPushPlugin.prototype.call_native");
ret = cordova.exec(callback,this.error_callback,'JPushPlugin',name,args);
console.log("end JPushPlugin.prototype.call_native");
return ret;
}
JPushPlugin.prototype.getRegistrationID = function(callback){
this.call_native("getRegistrationID",null,callback);
}
JPushPlugin.prototype.startLogPageView = function(data){
this.call_native( "startLogPageView",[data],null);
}
@@ -27,23 +27,39 @@ JPushPlugin.prototype.stopLogPageView = function(data){
}
JPushPlugin.prototype.setTagsWithAlias = function(tags,alias){
if(tags==null){
this.setAlias(alias);
return;
}
if(alias==null){
this.setTags(tags);
return;
try{
if(tags==null){
this.setAlias(alias);
return;
}
if(alias==null){
this.setTags(tags);
return;
}
var arrayTagWithAlias=[tags];
arrayTagWithAlias.unshift(alias);
this.call_native( "setTagsWithAlias", arrayTagWithAlias,null);
}
var arrayTagWithAlias=[tags];
arrayTagWithAlias.unshift(alias);
this.call_native( "setTagsWithAlias", arrayTagWithAlias,null);
catch(exception){
console.log(exception);
}
}
JPushPlugin.prototype.getRegistrationID = function(callback){
try{
var data=[];
this.call_native("getRegistrationID",[data],callback);
}
catch(exception){
console.log(exception);
}
}
JPushPlugin.prototype.setTags = function(data){
try{
this.call_native("setTags",[data],null);
this.call_native("setTags",data,null);
}
catch(exception){
console.log(exception);
@@ -52,7 +68,7 @@ JPushPlugin.prototype.setTags = function(data){
JPushPlugin.prototype.setAlias = function(data){
try{
this.call_native("setAlias", [data],null);
this.call_native("setAlias",[data],null);
}
catch(exception){
console.log(exception);
@@ -61,6 +77,7 @@ JPushPlugin.prototype.setAlias = function(data){
JPushPlugin.prototype.pushCallback = function(data){
try{
console.log(data);
var bToObj=JSON.parse(data);
var code = bToObj.resultCode;
var tags = bToObj.resultTags;