mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-19 05:22:57 +08:00
add android interface complate
This commit is contained in:
parent
aa47ff4d54
commit
77a71b4104
@ -13,7 +13,7 @@
|
||||
var onDeviceReady = function(){
|
||||
console.log("Device ready!")
|
||||
initiateUI();
|
||||
}
|
||||
}
|
||||
var onTagsWithAlias = function(event){
|
||||
try{
|
||||
console.log("onTagsWithAlias");
|
||||
@ -37,9 +37,20 @@
|
||||
}
|
||||
}
|
||||
var initiateUI = function(){
|
||||
|
||||
window.plugins.jPushPlugin.getRegistrationID(onGetRegistradionID);
|
||||
|
||||
//test android interface
|
||||
//window.plugins.jPushPlugin.getNotification(onNotification);
|
||||
//window.plugins.jPushPlugin.stopPush()
|
||||
//window.plugins.jPushPlugin.resumePush();
|
||||
//window.plugins.jPushPlugin.clearAllNoticication();
|
||||
//window.plugins.jPushPlugin.setLatestNotificationNum(5);
|
||||
//window.plugins.jPushPlugin.stopPush();
|
||||
//window.plugins.jPushPlugin.isPushStopped(onIsPushStopped);
|
||||
//window.plugins.jPushPlugin.init();
|
||||
//window.plugins.jPushPlugin.setDebugable(true);
|
||||
//window.plugins.jPushPlugin.startLogPageView("mianPage");
|
||||
|
||||
$("#setTagWithAliasButton").click(function(ev) {
|
||||
try{
|
||||
var tag1 = $("#tagText1").attr("value");
|
||||
@ -61,8 +72,8 @@
|
||||
dd.push(tag3);
|
||||
}
|
||||
}
|
||||
//window.plugins.jPushPlugin.setTagsWithAlias(dd,alias);
|
||||
window.plugins.jPushPlugin.setTags(dd);
|
||||
window.plugins.jPushPlugin.setTagsWithAlias(dd,alias);
|
||||
|
||||
}
|
||||
catch(exception){
|
||||
console.log(exception);
|
||||
|
@ -42,13 +42,14 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
"resumePush",
|
||||
"isPushStopped",
|
||||
"setLatestNotificationNum",
|
||||
"setPushTime");
|
||||
"setPushTime",
|
||||
"clearAllNotification");
|
||||
|
||||
private ExecutorService threadPool = Executors.newFixedThreadPool(1);
|
||||
private static JPushPlugin instance;
|
||||
|
||||
public static String notificationAlert;
|
||||
public static Map<String, String> notificationExtras;
|
||||
public static Map<String, String> notificationExtras=new HashMap<String, String>();
|
||||
|
||||
public JPushPlugin() {
|
||||
instance = this;
|
||||
@ -146,8 +147,12 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
void isPushStopped(JSONArray data,
|
||||
CallbackContext callbackContext){
|
||||
JPushInterface.isPushStopped(this.cordova.getActivity().getApplicationContext());
|
||||
callbackContext.success();
|
||||
boolean isStoped =JPushInterface.isPushStopped(this.cordova.getActivity().getApplicationContext());
|
||||
if(isStoped){
|
||||
callbackContext.success(1);
|
||||
}else{
|
||||
callbackContext.success(0);
|
||||
}
|
||||
}
|
||||
|
||||
void setLatestNotificationNum(JSONArray data,
|
||||
|
@ -18,12 +18,16 @@ JPushPlugin.prototype.call_native = function(name, args, callback){
|
||||
return ret;
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.startLogPageView = function(data){
|
||||
this.call_native( "startLogPageView",[data],null);
|
||||
JPushPlugin.prototype.startLogPageView = function(data){
|
||||
if(this.isPlatformIOS()){
|
||||
this.call_native( "startLogPageView",[data],null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.stopLogPageView = function(data){
|
||||
this.call_native( "stopLogPageView",[data],null);
|
||||
if(this.isPlatformIOS()){
|
||||
this.call_native( "stopLogPageView",[data],null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setTagsWithAlias = function(tags,alias){
|
||||
@ -88,8 +92,77 @@ JPushPlugin.prototype.pushCallback = function(data){
|
||||
console.log(exception);
|
||||
}
|
||||
}
|
||||
//android
|
||||
//ios
|
||||
//android single
|
||||
|
||||
JPushPlugin.prototype.getNotification = function (callback) {
|
||||
if(device.platform == "Android") {
|
||||
data=[];
|
||||
this.call_native("getNotification",data,callback);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[]
|
||||
this.call_native("setBasicPushNotificationBuilder",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setCustomPushNotificationBuilder = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[];
|
||||
this.call_native("setCustomPushNotificationBuilder",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.stopPush = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[];
|
||||
this.call_native("stopPush",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.resumePush = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[]
|
||||
this.call_native("resumePush",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.clearAllNoticication = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[]
|
||||
this.call_native("clearAllNotification",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setLatestNotificationNum = function(num){
|
||||
if(device.platform == "Android") {
|
||||
this.call_native("setLatestNotificationNum",[num],null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.isPushStopped = function(callback){
|
||||
if(device.platform == "Android") {
|
||||
data=[];
|
||||
this.call_native("isPushStopped",data,callback)
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.init = function(){
|
||||
if(device.platform == "Android") {
|
||||
data=[];
|
||||
this.call_native("init",data,null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setDebugable = function(mode){
|
||||
if(device.platform == "Android") {
|
||||
this.call_native("setDebugable",[mode],null);
|
||||
}
|
||||
}
|
||||
|
||||
//ios single
|
||||
|
||||
|
||||
if(!window.plugins){
|
||||
|
Loading…
Reference in New Issue
Block a user