修正安装文档,使安装过程更简洁

This commit is contained in:
zhangqinghe
2015-01-19 16:37:44 +08:00
parent 2c3bd5ab38
commit 39b7987b25
4 changed files with 40 additions and 36 deletions
+16 -13
View File
@@ -19,11 +19,12 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map.Entry;
//import com.your.package.name.R;
import your.package.name.R;
import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.CustomPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.data.JPushLocalNotification;
import cn.jpush.android.api.TagAliasCallback;
public class JPushPlugin extends CordovaPlugin {
@@ -62,10 +63,11 @@ public class JPushPlugin extends CordovaPlugin {
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
JPushInterface.setDebugMode(true);
JPushInterface.init(cordova.getActivity().getApplicationContext());
//JPushInterface.setDebugMode(true);
//JPushInterface.init(cordova.getActivity().getApplicationContext());
}
private static JSONObject notificationObject(String message,
Map<String, Object> extras) {
JSONObject data = new JSONObject();
@@ -162,16 +164,17 @@ public class JPushPlugin extends CordovaPlugin {
}
void setDebugMode(JSONArray data, CallbackContext callbackContext) {
String mode;
boolean mode;
try {
mode = data.getString(0);
if (mode.equals("true")) {
JPushInterface.setDebugMode(true);
} else if (mode.equals("false")) {
JPushInterface.setDebugMode(false);
} else {
callbackContext.error("error mode");
}
mode = data.getBoolean(0);
// if (mode.equals("true")) {
// JPushInterface.setDebugMode(true);
// } else if (mode.equals("false")) {
// JPushInterface.setDebugMode(false);
// } else {
// callbackContext.error("error mode");
// }
JPushInterface.setDebugMode(mode);
callbackContext.success();
} catch (JSONException e) {
}
@@ -209,7 +212,7 @@ public class JPushPlugin extends CordovaPlugin {
callbackContext.error("error reading num json");
}
if(num != -1){
JPushInterface.setLatestNotifactionNumber(this.cordova.getActivity().getApplicationContext(), num);
JPushInterface.setLatestNotificationNumber(this.cordova.getActivity().getApplicationContext(), num);
}else{
callbackContext.error("error num");
}