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