mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-05-07 11:02:58 +08:00
modify,new features
This commit is contained in:
parent
134d721aaf
commit
d0997bed2e
@ -37,11 +37,11 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
"isPushStopped",
|
||||
"setLatestNotificationNum",
|
||||
"setPushTime");
|
||||
private ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
private ExecutorService threadPool = Executors.newFixedThreadPool(1);
|
||||
private static JPushPlugin instance;
|
||||
|
||||
public static String incomingAlert;
|
||||
public static Map<String, String> incomingExtras;
|
||||
public static String notificationAlert;
|
||||
public static Map<String, String> notificationExtras;
|
||||
|
||||
public JPushPlugin() {
|
||||
instance = this;
|
||||
@ -66,7 +66,7 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
return data;
|
||||
}
|
||||
|
||||
static void raisePush(String message, Map<String, String> extras) {
|
||||
static void transmitPush(String message, Map<String, String> extras) {
|
||||
if (instance == null) {
|
||||
return;
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
if (!methodList.contains(action)) {
|
||||
return false;
|
||||
}
|
||||
executorService.execute(new Runnable() {
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@ -230,9 +230,9 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
void getIncoming(JSONArray data, CallbackContext callBackContext) {
|
||||
String alert = JPushPlugin.incomingAlert;
|
||||
Map<String, String> extras = JPushPlugin.incomingExtras;
|
||||
void getNotification(JSONArray data, CallbackContext callBackContext) {
|
||||
String alert = JPushPlugin.notificationAlert;
|
||||
Map<String, String> extras = JPushPlugin.notificationExtras;
|
||||
|
||||
JSONObject jsonData = new JSONObject();
|
||||
try {
|
||||
@ -244,8 +244,8 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
callBackContext.success(jsonData);
|
||||
|
||||
JPushPlugin.incomingAlert = "";
|
||||
JPushPlugin.incomingExtras = new HashMap<String, String>();
|
||||
JPushPlugin.notificationAlert = "";
|
||||
JPushPlugin.notificationExtras = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
void setBasicPushNotificationBuilder(JSONArray data,
|
||||
|
@ -37,7 +37,7 @@ public class MyReceiver extends BroadcastReceiver {
|
||||
String msg = intent.getStringExtra(JPushInterface.EXTRA_MESSAGE);
|
||||
Map<String,String> extras = getNotificationExtras(intent);
|
||||
|
||||
JPushPlugin.raisePush(msg, extras);
|
||||
JPushPlugin.transmitPush(msg, extras);
|
||||
}
|
||||
private void handlingNotificationOpen(Context context,Intent intent){
|
||||
String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
|
||||
@ -47,8 +47,8 @@ public class MyReceiver extends BroadcastReceiver {
|
||||
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
JPushPlugin.incomingAlert = alert;
|
||||
JPushPlugin.incomingExtras = extras;
|
||||
JPushPlugin.notificationAlert = alert;
|
||||
JPushPlugin.notificationExtras = extras;
|
||||
|
||||
context.startActivity(launch);
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ JPushPlugin.prototype.pushCallback = function (data) {
|
||||
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.getIncoming = function (callback) {
|
||||
this.call_native(callback, "getIncoming");
|
||||
JPushPlugin.prototype.getNotification = function (callback) {
|
||||
this.call_native(callback, "getNotification");
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(callback){
|
||||
|
Loading…
x
Reference in New Issue
Block a user