mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4215437bd6 | |||
| 8db89c9f2e | |||
| 992246235d | |||
| 8e0fee7276 | |||
| 734077536b | |||
| bce9508ec5 | |||
| ea685713db | |||
| 4c810fcaa9 | |||
| 213e5b7bb1 | |||
| 1af99fe4bf | |||
| 3e55f6f2c4 | |||
| ec40fd3e58 | |||
| e6819f54e2 | |||
| 386d1282e9 | |||
| d55a46c54c | |||
| bfe0a76ae0 | |||
| 7cc3239e1b | |||
| 34857a1eea |
@@ -1,65 +1,66 @@
|
|||||||
## JPush PhoneGap Plugin ##
|
## JPush PhoneGap Plugin ##
|
||||||
###创建项目###
|
###创建项目###
|
||||||
1. cordova create 文件夹名字 包名 应用名字
|
1. cordova create 文件夹名字 包名 应用名字
|
||||||
```
|
|
||||||
cordova create Myproj com.myproj.jpush MyTestProj
|
cordova create Myproj com.myproj.jpush MyTestProj
|
||||||
```
|
|
||||||
|
|
||||||
2. 添加平台
|
2. 添加平台
|
||||||
```
|
|
||||||
cd Myproj :不进行这一步可能会出现[RangeError:Maximum call stack size exceeded]
|
|
||||||
cordova platform add android
|
|
||||||
```
|
|
||||||
|
|
||||||
### Android自动安装 ###
|
cd Myproj :不进行这一步可能会出现[RangeError:Maximum call stack size exceeded]
|
||||||
|
cordova platform add android
|
||||||
|
|
||||||
|
|
||||||
|
### Android使用PhoneGap/Cordova CLI自动安装
|
||||||
|
|
||||||
1. 使用 phonegap 或者 cordova cli 添加插件(建议在git客户端下使用,在windows 的cmd界面下 该命令提示git command line tool 不可用):
|
1. 使用 phonegap 或者 cordova cli 添加插件(建议在git客户端下使用,在windows 的cmd界面下 该命令提示git command line tool 不可用):
|
||||||
```
|
|
||||||
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git
|
|
||||||
```
|
|
||||||
|
|
||||||
2. 修改www/config.xml文件,添加或者覆盖以下字段
|
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git
|
||||||
|
|
||||||
####IOS使用PhoneGap/Cordova CLI自动安装
|
|
||||||
|
|
||||||
1.使用PhoneGap/Cordova CLI命令安装
|
2. 修改[your project]/plugins/android.json生成脚本的JPUSH_APPKEY字段
|
||||||
```
|
|
||||||
cordova plugin add https://github.com/zhangqinghe/test.phonegap.git
|
"xml": "<meta-data android:name=\"JPUSH_APPKEY\" android:value=\"your appkey in JPush Portal\" />",
|
||||||
cordova platforms add ios
|
|
||||||
cordova build ios
|
3. 执行 cordova build android 使修改的`JPUSH_APPKEY`写入AndroidManifest.xml文件
|
||||||
```
|
|
||||||
|
> 温馨提示:如果使用eclipse来生成安装包,步骤2与步骤3可省略。直接在AndroidManifest.xml文件中修改JPUSH_APPKEY即可
|
||||||
|
|
||||||
|
|
||||||
|
###IOS使用PhoneGap/Cordova CLI自动安装
|
||||||
|
|
||||||
|
1. 使用PhoneGap/Cordova CLI命令安装
|
||||||
|
|
||||||
|
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git
|
||||||
|
cordova build ios
|
||||||
|
|
||||||
|
2. 修改Resources/PushConfig.plist文件
|
||||||
|
|
||||||
2.修改Resources/PushConfig.plist文件
|
|
||||||
```
|
|
||||||
在APP_KEY和CHANNLE字段 分别添加您的appkey和channle
|
在APP_KEY和CHANNLE字段 分别添加您的appkey和channle
|
||||||
```
|
|
||||||
3.添加监听系统事件,相应地调用 JPush SDK 提供的 API 来实现功能
|
|
||||||
```
|
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
3. 添加监听系统事件,相应地调用 JPush SDK 提供的 API 来实现功能
|
||||||
{
|
|
||||||
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
|
|
||||||
self.window.backgroundColor = [UIColor whiteColor];
|
|
||||||
[self.window makeKeyAndVisible];
|
|
||||||
// Required
|
|
||||||
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
|
||||||
UIRemoteNotificationTypeSound |
|
|
||||||
UIRemoteNotificationTypeAlert)];
|
|
||||||
// Required
|
|
||||||
[APService setupWithOption:launchOptions];
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
||||||
// Required
|
|
||||||
[APService registerDeviceToken:deviceToken];
|
|
||||||
}
|
|
||||||
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
|
||||||
// Required
|
|
||||||
[APService handleRemoteNotification:userInfo];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
|
||||||
|
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
|
||||||
|
self.window.backgroundColor = [UIColor whiteColor];
|
||||||
|
[self.window makeKeyAndVisible];
|
||||||
|
// Required
|
||||||
|
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
||||||
|
UIRemoteNotificationTypeSound |
|
||||||
|
UIRemoteNotificationTypeAlert)];
|
||||||
|
// Required
|
||||||
|
[APService setupWithOption:launchOptions];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||||
|
// Required
|
||||||
|
[APService registerDeviceToken:deviceToken];
|
||||||
|
}
|
||||||
|
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
||||||
|
// Required
|
||||||
|
[APService handleRemoteNotification:userInfo];
|
||||||
|
}
|
||||||
|
|
||||||
###Android 手工安装###
|
###Android 手工安装###
|
||||||
1. 复制src/android/*.java 到cn/jpush/phonega/目录下(即:cn.jpush.phonegap的包下)
|
1. 复制src/android/*.java 到cn/jpush/phonega/目录下(即:cn.jpush.phonegap的包下)
|
||||||
2. 复制src/android/armeabi/libjpush.so 到lib/armeabi/
|
2. 复制src/android/armeabi/libjpush.so 到lib/armeabi/
|
||||||
@@ -68,188 +69,182 @@ cordova build ios
|
|||||||
5. 复制src/android/jpush_notification_icon.png 到res/drawable/
|
5. 复制src/android/jpush_notification_icon.png 到res/drawable/
|
||||||
6. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限
|
6. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限
|
||||||
|
|
||||||
```
|
<!-- Required 一些系统要求的权限,如访问网络等-->
|
||||||
<!-- Required 一些系统要求的权限,如访问网络等-->
|
<uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"/>
|
||||||
<uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"/>
|
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
<permission
|
||||||
<permission
|
android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
|
||||||
android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
|
android:protectionLevel="signature"/>
|
||||||
android:protectionLevel="signature"/>
|
|
||||||
```
|
|
||||||
7. 修改AndroidManifest.xml 在 manifest/application 节点下添加SDK相关组件声明
|
7. 修改AndroidManifest.xml 在 manifest/application 节点下添加SDK相关组件声明
|
||||||
|
|
||||||
```
|
<activity
|
||||||
<activity
|
android:name="cn.jpush.android.ui.PushActivity"
|
||||||
android:name="cn.jpush.android.ui.PushActivity"
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
android:configChanges="orientation|keyboardHidden">
|
||||||
android:configChanges="orientation|keyboardHidden">
|
<intent-filter>
|
||||||
<intent-filter>
|
<action android:name="cn.jpush.android.ui.PushActivity"/>
|
||||||
<action android:name="cn.jpush.android.ui.PushActivity"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="$PACKAGE_NAME"/>
|
||||||
<category android:name="$PACKAGE_NAME"/>
|
</intent-filter>
|
||||||
</intent-filter>
|
</activity>
|
||||||
</activity>
|
<!-- Required SDK核心功能-->
|
||||||
<!-- Required SDK核心功能-->
|
<service
|
||||||
<service
|
android:name="cn.jpush.android.service.DownloadService"
|
||||||
android:name="cn.jpush.android.service.DownloadService"
|
android:enabled="true"
|
||||||
android:enabled="true"
|
android:exported="false">
|
||||||
android:exported="false">
|
</service>
|
||||||
</service>
|
<!-- Required SDK 核心功能-->
|
||||||
<!-- Required SDK 核心功能-->
|
<service
|
||||||
<service
|
android:name="cn.jpush.android.service.PushService"
|
||||||
android:name="cn.jpush.android.service.PushService"
|
android:enabled="true"
|
||||||
android:enabled="true"
|
android:exported="false">
|
||||||
android:exported="false">
|
<intent-filter>
|
||||||
<intent-filter>
|
<action android:name="cn.jpush.android.intent.REGISTER"/>
|
||||||
<action android:name="cn.jpush.android.intent.REGISTER"/>
|
<action android:name="cn.jpush.android.intent.REPORT"/>
|
||||||
<action android:name="cn.jpush.android.intent.REPORT"/>
|
<action android:name="cn.jpush.android.intent.PushService"/>
|
||||||
<action android:name="cn.jpush.android.intent.PushService"/>
|
<action android:name="cn.jpush.android.intent.PUSH_TIME"/>
|
||||||
<action android:name="cn.jpush.android.intent.PUSH_TIME"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<!-- Required SDK核心功能-->
|
<!-- Required SDK核心功能-->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jpush.android.service.PushReceiver"
|
android:name="cn.jpush.android.service.PushReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY"/>
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY"/>
|
||||||
<!--Required 显示通知栏 -->
|
<!--Required 显示通知栏 -->
|
||||||
<category android:name="$PACKAGE_NAME"/>
|
<category android:name="$PACKAGE_NAME"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.USER_PRESENT"/>
|
<action android:name="android.intent.action.USER_PRESENT"/>
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<!-- Optional -->
|
<!-- Optional -->
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
||||||
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
||||||
<data android:scheme="package"/>
|
<data android:scheme="package"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||||
|
<receiver
|
||||||
|
android:name="cn.jpush.phonegap.MyReceiver"
|
||||||
|
android:enabled="true">
|
||||||
|
<intent-filter android:priority="1000">
|
||||||
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY"/>
|
||||||
|
<!-- Required 显示通知栏 -->
|
||||||
|
<category android:name="$PACKAGE_NAME"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.jpush.android.intent.REGISTRATION"/>
|
||||||
|
<!-- Required 用户注册SDK的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.UNREGISTRATION"/>
|
||||||
|
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED"/>
|
||||||
|
<!-- Required 用户接收SDK消息的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED"/>
|
||||||
|
<!-- Required 用户接收SDK通知栏信息的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED"/>
|
||||||
|
<!-- Required 用户打开自定义通知栏的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK"/>
|
||||||
|
<!-- Optional 用户接受Rich Push Javascript 回调函数的intent -->
|
||||||
|
<category android:name="$PACKAGE_NAME"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
<!-- Required SDK核心功能-->
|
||||||
|
<receiver android:name="cn.jpush.android.service.AlarmReceiver"/>
|
||||||
|
<!-- Required . Enable it you can get statistics data with channel -->
|
||||||
|
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
|
||||||
|
<meta-data android:name="JPUSH_APPKEY" android:value="299d0fee887820e7d90a68b2"/>
|
||||||
|
|
||||||
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
|
||||||
<receiver
|
|
||||||
android:name="cn.jpush.phonegap.MyReceiver"
|
|
||||||
android:enabled="true">
|
|
||||||
<intent-filter android:priority="1000">
|
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY"/>
|
|
||||||
<!-- Required 显示通知栏 -->
|
|
||||||
<category android:name="$PACKAGE_NAME"/>
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="cn.jpush.android.intent.REGISTRATION"/>
|
|
||||||
<!-- Required 用户注册SDK的intent -->
|
|
||||||
<action android:name="cn.jpush.android.intent.UNREGISTRATION"/>
|
|
||||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED"/>
|
|
||||||
<!-- Required 用户接收SDK消息的intent -->
|
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED"/>
|
|
||||||
<!-- Required 用户接收SDK通知栏信息的intent -->
|
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED"/>
|
|
||||||
<!-- Required 用户打开自定义通知栏的intent -->
|
|
||||||
<action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK"/>
|
|
||||||
<!-- Optional 用户接受Rich Push Javascript 回调函数的intent -->
|
|
||||||
<category android:name="$PACKAGE_NAME"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
<!-- Required SDK核心功能-->
|
|
||||||
<receiver android:name="cn.jpush.android.service.AlarmReceiver"/>
|
|
||||||
<!-- Required . Enable it you can get statistics data with channel -->
|
|
||||||
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
|
|
||||||
<meta-data android:name="JPUSH_APPKEY" android:value="299d0fee887820e7d90a68b2"/>
|
|
||||||
|
|
||||||
```
|
|
||||||
### IOS手工安装
|
### IOS手工安装
|
||||||
|
|
||||||
1.添加src/ios/Plugins/到project中
|
1. 添加src/ios/Plugins/到project中
|
||||||
2.添加src/ios/lib/到project中
|
2. 添加src/ios/lib/到project中
|
||||||
3.设置 Search Paths 下的 User Header Search Paths 和 Library Search Paths
|
3. 设置 Search Paths 下的 User Header Search Paths 和 Library Search Paths
|
||||||
```
|
|
||||||
|
|
||||||
比如SDK文件夹(默认为lib)与工程文件在同一级目录下,则都设置为"$(SRCROOT)/[文件夹名称]"即可。
|
比如SDK文件夹(默认为lib)与工程文件在同一级目录下,则都设置为"$(SRCROOT)/[文件夹名称]"即可。
|
||||||
```
|
|
||||||
|
|
||||||
4.确认一下的框架是存在的(Target -> Build Phases -> Link Binary With Libraries)
|
4. 确认一下的框架是存在的(Target -> Build Phases -> Link Binary With Libraries)
|
||||||
```
|
|
||||||
|
|
||||||
CFNetwork.framework
|
CFNetwork.framework
|
||||||
CoreFoundation.framework
|
CoreFoundation.framework
|
||||||
CoreTelephony.framework
|
CoreTelephony.framework
|
||||||
SystemConfiguration.framework
|
SystemConfiguration.framework
|
||||||
CoreGraphics.framework
|
CoreGraphics.framework
|
||||||
Foundation.framework
|
Foundation.framework
|
||||||
UIKit.framework
|
UIKit.framework
|
||||||
```
|
|
||||||
|
|
||||||
5.在你的工程中创建一个新的Property List文件
|
|
||||||
```
|
|
||||||
|
|
||||||
并将其命名为PushConfig.plist,填入Portal为你的应用提供的APP_KEY等参数
|
5. 在你的工程中创建一个新的Property List文件
|
||||||
```
|
|
||||||
|
|
||||||
6.调用代码,监听系统事件,相应地调用 JPush SDK 提供的 API 来实现功能
|
并将其命名为PushConfig.plist,填入Portal为你的应用提供的APP_KEY等参数
|
||||||
```
|
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
||||||
{
|
|
||||||
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
|
|
||||||
self.window.backgroundColor = [UIColor whiteColor];
|
|
||||||
[self.window makeKeyAndVisible];
|
|
||||||
|
|
||||||
// Required
|
6. 调用代码,监听系统事件,相应地调用 JPush SDK 提供的 API 来实现功能
|
||||||
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
|
||||||
UIRemoteNotificationTypeSound |
|
|
||||||
UIRemoteNotificationTypeAlert)];
|
|
||||||
// Required
|
|
||||||
[APService setupWithOption:launchOptions];
|
|
||||||
|
|
||||||
return YES;
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
}
|
{
|
||||||
|
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
|
||||||
|
self.window.backgroundColor = [UIColor whiteColor];
|
||||||
|
[self.window makeKeyAndVisible];
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
// Required
|
||||||
|
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
||||||
|
UIRemoteNotificationTypeSound |
|
||||||
|
UIRemoteNotificationTypeAlert)];
|
||||||
|
// Required
|
||||||
|
[APService setupWithOption:launchOptions];
|
||||||
|
|
||||||
// Required
|
return YES;
|
||||||
[APService registerDeviceToken:deviceToken];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
[APService handleRemoteNotification:userInfo];
|
[APService registerDeviceToken:deviceToken];
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
7.修改phonegap config.xml文件用来包含Plugin/内的插件
|
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
||||||
```
|
|
||||||
|
|
||||||
<feature name="JPushPlugin">
|
// Required
|
||||||
<param name="ios-package" value="JPushPlugin" />
|
[APService handleRemoteNotification:userInfo];
|
||||||
<param name="onload" value="true" />
|
}
|
||||||
</feature>
|
|
||||||
```
|
|
||||||
|
|
||||||
8.复制www/PushNotification.js到工程的www目录下面
|
|
||||||
9.在需要使用插件处加入
|
|
||||||
```
|
|
||||||
|
|
||||||
<script type="text/javascript" src="JPushPlugin.js"></script>
|
7. 修改phonegap config.xml文件用来包含Plugin/内的插件
|
||||||
```
|
|
||||||
|
|
||||||
|
<feature name="JPushPlugin">
|
||||||
|
<param name="ios-package" value="JPushPlugin" />
|
||||||
|
<param name="onload" value="true" />
|
||||||
|
</feature>
|
||||||
|
|
||||||
|
|
||||||
|
8. 复制www/PushNotification.js到工程的www目录下面
|
||||||
|
9. 在需要使用插件处加入
|
||||||
|
|
||||||
|
<script type="text/javascript" src="JPushPlugin.js"></script>
|
||||||
|
|
||||||
###示例
|
###示例
|
||||||
1.完整的示例可以点击网页右侧的"Download Zip"下载,下载完成后在文件的"src/ios/example"文件夹内找到并拷贝以下文件
|
|
||||||
```
|
|
||||||
|
|
||||||
src/ios/example/index.html to www/index.html
|
1. 完整的示例可以点击网页右侧的"Download Zip"下载,下载完成后在文件的"src/ios/example"文件夹内找到并拷贝以下文件
|
||||||
src/ios/example/css/* to www/css
|
|
||||||
src/ios/example/js/* to www/js
|
|
||||||
```
|
|
||||||
|
|
||||||
|
src/ios/example/index.html to www/index.html
|
||||||
|
src/ios/example/css/* to www/css
|
||||||
|
src/ios/example/js/* to www/js
|
||||||
|
|
||||||
|
###关于'phonegap build'云服务
|
||||||
|
|
||||||
|
该项目基于cordova实现,目前无法使用'phonegap build'云服务进行打包,建议使用本地环境进行打包
|
||||||
|
|||||||
+3
-9
@@ -11,7 +11,7 @@
|
|||||||
<script type="text/javascript" src="cordova.js"></script>
|
<script type="text/javascript" src="cordova.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var onDeviceReady = function(){
|
var onDeviceReady = function(){
|
||||||
console.log("Device ready!")
|
console.log("JPushPlugin:Device ready!")
|
||||||
initiateUI();
|
initiateUI();
|
||||||
}
|
}
|
||||||
var onTagsWithAlias = function(event){
|
var onTagsWithAlias = function(event){
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
var onGetRegistradionID = function(data) {
|
var onGetRegistradionID = function(data) {
|
||||||
try{
|
try{
|
||||||
console.log("index.registrationID:"+data)
|
console.log("JPushPlugin:registrationID is "+data)
|
||||||
|
|
||||||
$("#registrationid").html(data);
|
$("#registrationid").html(data);
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
window.plugins.jPushPlugin.getRegistrationID(onGetRegistradionID);
|
window.plugins.jPushPlugin.getRegistrationID(onGetRegistradionID);
|
||||||
//test android interface
|
//test android interface
|
||||||
//window.plugins.jPushPlugin.getNotification(onNotification);
|
|
||||||
//window.plugins.jPushPlugin.stopPush()
|
//window.plugins.jPushPlugin.stopPush()
|
||||||
//window.plugins.jPushPlugin.resumePush();
|
//window.plugins.jPushPlugin.resumePush();
|
||||||
//window.plugins.jPushPlugin.clearAllNoticication();
|
//window.plugins.jPushPlugin.clearAllNoticication();
|
||||||
@@ -48,7 +47,7 @@
|
|||||||
//window.plugins.jPushPlugin.stopPush();
|
//window.plugins.jPushPlugin.stopPush();
|
||||||
//window.plugins.jPushPlugin.isPushStopped(onIsPushStopped);
|
//window.plugins.jPushPlugin.isPushStopped(onIsPushStopped);
|
||||||
//window.plugins.jPushPlugin.init();
|
//window.plugins.jPushPlugin.init();
|
||||||
//window.plugins.jPushPlugin.setDebugable(true);
|
//window.plugins.jPushPlugin.setDebugMode(true);
|
||||||
//window.plugins.jPushPlugin.startLogPageView("mianPage");
|
//window.plugins.jPushPlugin.startLogPageView("mianPage");
|
||||||
|
|
||||||
$("#setTagWithAliasButton").click(function(ev) {
|
$("#setTagWithAliasButton").click(function(ev) {
|
||||||
@@ -87,11 +86,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<div data-role="page" id="page">
|
<div data-role="page" id="page">
|
||||||
|
|
||||||
<div data-role="header" class="ui-bar ui-bar-b">
|
|
||||||
<center>
|
|
||||||
<img border="0" src="img/logo.png" alt="Urban Airship" align="center" />
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<form>
|
<form>
|
||||||
<div class="ui-body ui-body-b">
|
<div class="ui-body ui-body-b">
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="cn.jpush.phonegap.JPushPlugin"
|
id="cn.jpush.phonegap.JPushPlugin"
|
||||||
version="1.5.3">
|
version="1.5.4">
|
||||||
|
|
||||||
<name>JPush Plugin</name>
|
<name>JPush Plugin</name>
|
||||||
<description>JPush for cordova plugin</description>
|
<description>JPush for cordova plugin</description>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
"setCustomPushNotificationBuilder",
|
"setCustomPushNotificationBuilder",
|
||||||
"setPushTime",
|
"setPushTime",
|
||||||
"init",
|
"init",
|
||||||
"setDebugable",
|
"setDebugMode",
|
||||||
"stopPush",
|
"stopPush",
|
||||||
"resumePush",
|
"resumePush",
|
||||||
"isPushStopped",
|
"isPushStopped",
|
||||||
@@ -74,13 +74,24 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static JSONObject openNotificationObject(String alert,
|
||||||
|
Map<String, String> extras){
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
try {
|
||||||
|
data.put("alert", alert);
|
||||||
|
data.put("extras", new JSONObject(extras));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
static void transmitPush(String message, Map<String, String> extras) {
|
static void transmitPush(String message, Map<String, String> extras) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject data = notificationObject(message, extras);
|
JSONObject data = notificationObject(message, extras);
|
||||||
String js = String
|
String js = String
|
||||||
.format("window.plugins.jPushPlugin.pushCallback(%s);",
|
.format("window.plugins.jPushPlugin.recieveMessageInAndroidCallback(%s);",
|
||||||
data.toString());
|
data.toString());
|
||||||
try {
|
try {
|
||||||
instance.webView.sendJavascript(js);
|
instance.webView.sendJavascript(js);
|
||||||
@@ -90,7 +101,22 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void transmitOpen(String alert, Map<String, String> extras) {
|
||||||
|
if (instance == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject data = openNotificationObject(alert, extras);
|
||||||
|
String js = String
|
||||||
|
.format("window.plugins.jPushPlugin.openNotificationInAndroidCallback(%s);",
|
||||||
|
data.toString());
|
||||||
|
try {
|
||||||
|
instance.webView.sendJavascript(js);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final String action, final JSONArray data,
|
public boolean execute(final String action, final JSONArray data,
|
||||||
final CallbackContext callbackContext) throws JSONException {
|
final CallbackContext callbackContext) throws JSONException {
|
||||||
@@ -114,10 +140,10 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
|
|
||||||
void init(JSONArray data,CallbackContext callbackContext){
|
void init(JSONArray data,CallbackContext callbackContext){
|
||||||
JPushInterface.init(this.cordova.getActivity().getApplicationContext());
|
JPushInterface.init(this.cordova.getActivity().getApplicationContext());
|
||||||
callbackContext.success();
|
//callbackContext.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDebugable(JSONArray data, CallbackContext callbackContext) {
|
void setDebugMode(JSONArray data, CallbackContext callbackContext) {
|
||||||
String mode;
|
String mode;
|
||||||
try {
|
try {
|
||||||
mode = data.getString(0);
|
mode = data.getString(0);
|
||||||
@@ -147,8 +173,8 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
|
|
||||||
void isPushStopped(JSONArray data,
|
void isPushStopped(JSONArray data,
|
||||||
CallbackContext callbackContext){
|
CallbackContext callbackContext){
|
||||||
boolean isStoped =JPushInterface.isPushStopped(this.cordova.getActivity().getApplicationContext());
|
boolean isStopped =JPushInterface.isPushStopped(this.cordova.getActivity().getApplicationContext());
|
||||||
if(isStoped){
|
if(isStopped){
|
||||||
callbackContext.success(1);
|
callbackContext.success(1);
|
||||||
}else{
|
}else{
|
||||||
callbackContext.success(0);
|
callbackContext.success(0);
|
||||||
@@ -174,13 +200,13 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
void setPushTime(JSONArray data,
|
void setPushTime(JSONArray data,
|
||||||
CallbackContext callbackContext){
|
CallbackContext callbackContext){
|
||||||
Set<Integer> days = new HashSet<Integer>();
|
Set<Integer> days = new HashSet<Integer>();
|
||||||
JSONArray dayArr;
|
JSONArray dayArray;
|
||||||
int startHour = -1;
|
int startHour = -1;
|
||||||
int endHour = -1;
|
int endHour = -1;
|
||||||
try {
|
try {
|
||||||
dayArr = data.getJSONArray(0);
|
dayArray = data.getJSONArray(0);
|
||||||
for (int i = 0; i < dayArr.length(); i++) {
|
for (int i = 0; i < dayArray.length(); i++) {
|
||||||
days.add(dayArr.getInt(i));
|
days.add(dayArray.getInt(i));
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -212,8 +238,8 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
tags= new HashSet<String>();
|
tags= new HashSet<String>();
|
||||||
}else{
|
}else{
|
||||||
tagStr = data.getString(0);
|
tagStr = data.getString(0);
|
||||||
String[] tagArr = tagStr.split(",");
|
String[] tagArray = tagStr.split(",");
|
||||||
for (String tag : tagArr) {
|
for (String tag : tagArray) {
|
||||||
tags.add(tag);
|
tags.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,9 +270,9 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
String alias;
|
String alias;
|
||||||
try {
|
try {
|
||||||
alias = data.getString(0);
|
alias = data.getString(0);
|
||||||
JSONArray tagsArr = data.getJSONArray(1);
|
JSONArray tagsArray = data.getJSONArray(1);
|
||||||
for (int i = 0; i < tagsArr.length(); i++) {
|
for (int i = 0; i < tagsArray.length(); i++) {
|
||||||
tags.add(tagsArr.getString(i));
|
tags.add(tagsArray.getString(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushInterface.setAliasAndTags(this.cordova.getActivity()
|
JPushInterface.setAliasAndTags(this.cordova.getActivity()
|
||||||
@@ -288,7 +314,7 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
callbackContext.success(obj);
|
//callbackContext.success(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCustomPushNotificationBuilder(JSONArray data,
|
void setCustomPushNotificationBuilder(JSONArray data,
|
||||||
@@ -305,13 +331,13 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
callbackContext.success(obj);
|
//callbackContext.success(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAllNotification(JSONArray data,
|
void clearAllNotification(JSONArray data,
|
||||||
CallbackContext callbackContext){
|
CallbackContext callbackContext){
|
||||||
JPushInterface.clearAllNotifications(this.cordova.getActivity());
|
JPushInterface.clearAllNotifications(this.cordova.getActivity());
|
||||||
callbackContext.success();
|
//callbackContext.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearNotificationById(JSONArray data,
|
void clearNotificationById(JSONArray data,
|
||||||
@@ -348,10 +374,6 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
.format("cordova.fireDocumentEvent('jpush.setTagsWithAlias',%s)",
|
.format("cordova.fireDocumentEvent('jpush.setTagsWithAlias',%s)",
|
||||||
data.toString());
|
data.toString());
|
||||||
instance.webView.sendJavascript(jsEvent);
|
instance.webView.sendJavascript(jsEvent);
|
||||||
String js = String
|
|
||||||
.format("window.plugins.jPushPlugin.pushCallback('%s');",
|
|
||||||
data.toString());
|
|
||||||
instance.webView.sendJavascript(js);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ public class MyReceiver extends BroadcastReceiver {
|
|||||||
JPushPlugin.notificationAlert = alert;
|
JPushPlugin.notificationAlert = alert;
|
||||||
JPushPlugin.notificationExtras = extras;
|
JPushPlugin.notificationExtras = extras;
|
||||||
|
|
||||||
|
JPushPlugin.transmitOpen(alert, extras);
|
||||||
|
|
||||||
context.startActivity(launch);
|
context.startActivity(launch);
|
||||||
}
|
}
|
||||||
private Map<String, String> getNotificationExtras(Intent intent) {
|
private Map<String, String> getNotificationExtras(Intent intent) {
|
||||||
|
|||||||
@@ -11,11 +11,24 @@
|
|||||||
|
|
||||||
@implementation JPushPlugin
|
@implementation JPushPlugin
|
||||||
|
|
||||||
|
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView{
|
||||||
|
if (self=[super initWithWebView:theWebView]) {
|
||||||
|
|
||||||
|
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
|
||||||
|
[defaultCenter addObserver:self
|
||||||
|
selector:@selector(networkDidReceiveMessage:)
|
||||||
|
name:kAPNetworkDidReceiveMessageNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
||||||
|
|
||||||
NSArray *arguments=command.arguments;
|
NSArray *arguments=command.arguments;
|
||||||
if (!arguments||[arguments count]<2) {
|
if (!arguments||[arguments count]<2) {
|
||||||
[self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",@""]];
|
// [self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",@""]];
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
NSString *alias=[arguments objectAtIndex:0];
|
NSString *alias=[arguments objectAtIndex:0];
|
||||||
@@ -51,8 +64,8 @@
|
|||||||
|
|
||||||
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
||||||
|
|
||||||
NSString* registratonID = [APService registrionID];
|
NSString* registrationID = [APService registrionID];
|
||||||
CDVPluginResult *result=[self pluginResultForValue:registratonID];
|
CDVPluginResult *result=[self pluginResultForValue:registrationID];
|
||||||
if (result) {
|
if (result) {
|
||||||
[self succeedWithPluginResult:result withCallbackID:command.callbackId];
|
[self succeedWithPluginResult:result withCallbackID:command.callbackId];
|
||||||
} else {
|
} else {
|
||||||
@@ -78,7 +91,7 @@
|
|||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.setTagsWithAlias',%@)",jsonString]];
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.setTagsWithAlias',%@)",jsonString]];
|
||||||
[self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",jsonString]];
|
// [self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",jsonString]];
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,5 +154,23 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)networkDidReceiveMessage:(NSNotification *)notification {
|
||||||
|
|
||||||
|
NSDictionary *userInfo = [notification userInfo];
|
||||||
|
NSLog(@"%@",userInfo);
|
||||||
|
|
||||||
|
NSError *error;
|
||||||
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
||||||
|
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
|
NSLog(@"%@",jsonString);
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|
||||||
|
[self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.receiveMessageIniOSCallback('%@')",jsonString]];
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
+47
-17
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
var JPushPlugin = function(){
|
var JPushPlugin = function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,14 +77,50 @@ JPushPlugin.prototype.setAlias = function(data){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.pushCallback = function(data){
|
JPushPlugin.prototype.receiveMessageIniOSCallback = function(data){
|
||||||
|
try{
|
||||||
|
console.log("JPushPlugin:receiveMessageIniOSCallback--data:"+data);
|
||||||
|
var bToObj = JSON.parse(data);
|
||||||
|
var content = bToObj.content;
|
||||||
|
console.log(content);
|
||||||
|
}
|
||||||
|
catch(exception){
|
||||||
|
console.log("JPushPlugin:receiveMessageIniOSCallback"+exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data){
|
||||||
|
try{
|
||||||
|
console.log("JPushPlugin:pushCallback--data:"+data);
|
||||||
|
var bToObj=JSON.parse(data);
|
||||||
|
var message = bToObj.message;
|
||||||
|
var extras = bToObj.extras;
|
||||||
|
|
||||||
|
console.log(message);
|
||||||
|
console.log(extras['cn.jpush.android.MSG_ID']);
|
||||||
|
console.log(extras['cn.jpush.android.CONTENT_TYPE']);
|
||||||
|
console.log(extras['cn.jpush.android.EXTRA']);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(exception){
|
||||||
|
console.log("JPushPlugin:pushCallback "+exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
JPushPlugin.prototype.openNotificationInAndroidCallback = function(data){
|
||||||
try{
|
try{
|
||||||
console.log(data);
|
console.log(data);
|
||||||
var bToObj=JSON.parse(data);
|
var bToObj = JSON.parse(data);
|
||||||
var code = bToObj.resultCode;
|
var alert = bToObj.alert;
|
||||||
var tags = bToObj.resultTags;
|
var extras = bToObj.extras;
|
||||||
var alias = bToObj.resultAlias;
|
console.log(alert);
|
||||||
console.log("JPushPlugin:callBack--code is "+code+" tags is "+tags + " alias is "+alias);
|
|
||||||
|
console.log(extras['cn.jpush.android.MSG_ID']);
|
||||||
|
console.log(extras['app']);
|
||||||
|
console.log(extras['cn.jpush.android.NOTIFICATION_CONTENT_TITLE']);
|
||||||
|
console.log(extras['cn.jpush.android.EXTRA']);
|
||||||
|
console.log(extras['cn.jpush.android.PUSH_ID']);
|
||||||
|
console.log(extras['cn.jpush.android.NOTIFICATION_ID']);
|
||||||
|
console.log("JPushPlugin:openNotificationCallback is ready");
|
||||||
}
|
}
|
||||||
catch(exception){
|
catch(exception){
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
@@ -91,13 +128,6 @@ JPushPlugin.prototype.pushCallback = function(data){
|
|||||||
}
|
}
|
||||||
//android single
|
//android single
|
||||||
|
|
||||||
JPushPlugin.prototype.getNotification = function (callback) {
|
|
||||||
if(device.platform == "Android") {
|
|
||||||
data=[];
|
|
||||||
this.call_native("getNotification",data,callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(){
|
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(){
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[]
|
data=[]
|
||||||
@@ -126,7 +156,7 @@ JPushPlugin.prototype.resumePush = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.clearAllNoticication = function(){
|
JPushPlugin.prototype.clearAllNotification = function(){
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[]
|
data=[]
|
||||||
this.call_native("clearAllNotification",data,null);
|
this.call_native("clearAllNotification",data,null);
|
||||||
@@ -153,13 +183,13 @@ JPushPlugin.prototype.init = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.setDebugable = function(mode){
|
JPushPlugin.prototype.setDebugMode = function(mode){
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
this.call_native("setDebugable",[mode],null);
|
this.call_native("setDebugMode",[mode],null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ios single
|
//iOS single
|
||||||
|
|
||||||
|
|
||||||
if(!window.plugins){
|
if(!window.plugins){
|
||||||
|
|||||||
Reference in New Issue
Block a user