增加统计接口

This commit is contained in:
zhangqinghe 2015-01-26 14:23:45 +08:00
parent 7c1c29a7ec
commit 260c298f6b
2 changed files with 41 additions and 1 deletions

View File

@ -48,7 +48,10 @@ public class JPushPlugin extends CordovaPlugin {
"clearAllNotification",
"addLocalNotification",
"removeLocalNotification",
"clearLocalNotifications");
"clearLocalNotifications",
"onResume",
"onPause",
"reportNotificationOpened");
private ExecutorService threadPool = Executors.newFixedThreadPool(1);
private static JPushPlugin instance;
@ -252,6 +255,23 @@ public class JPushPlugin extends CordovaPlugin {
String regID= JPushInterface.getRegistrationID(this.cordova.getActivity().getApplicationContext());
callbackContext.success(regID);
}
void onResume(JSONArray data, CallbackContext callbackContext) {
JPushInterface.onResume(this.cordova.getActivity());
}
void onPause(JSONArray data, CallbackContext callbackContext) {
JPushInterface.onPause(this.cordova.getActivity());
}
void reportNotificationOpened(JSONArray data, CallbackContext callbackContext) {
try {
String msgID;
msgID = data.getString(0);
JPushInterface.reportNotificationOpened(this.cordova.getActivity(),msgID);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
void setTags(JSONArray data, CallbackContext callbackContext) {

View File

@ -149,6 +149,7 @@ JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data){
console.log("JPushPlugin:pushCallback "+exception);
}
}
//
JPushPlugin.prototype.openNotificationInAndroidCallback = function(data){
try{
@ -253,6 +254,25 @@ JPushPlugin.prototype.clearLocalNotifications = function(){
this.call_native("clearLocalNotifications",data,null);
}
}
JPushPlugin.prototype.onResume = function(){
if(device.platform == "Android") {
data=[]
this.call_native("onResume",data,null);
}
}
JPushPlugin.prototype.onPause = function(){
if(device.platform == "Android") {
data=[]
this.call_native("onPause",data,null);
}
}
JPushPlugin.prototype.reportNotificationOpened = function(msgID){
if(device.platform == "Android") {
this.call_native("reportNotificationOpened",[msgID],null);
}
}
//iOS single