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