mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-19 05:22:57 +08:00
增加了benginLogPageView
This commit is contained in:
parent
3d74b92952
commit
4e687db4d3
58
README.md
58
README.md
@ -21,19 +21,21 @@
|
||||
cordova plugin add org.apache.cordova.device
|
||||
|
||||
|
||||
3. 修改[your project]/plugins/android.json生成脚本的JPUSH_APPKEY字段
|
||||
3. 在cn.jpush.phonegap的JPushPlugin.java文件开始处
|
||||
|
||||
import your.package.name.R;
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
|
||||
>温馨提示:如果使用eclipse来生成安装包,步骤4和5可省略。
|
||||
>直接在AndroidManifest.xml文件中修改JPUSH_APPKEY即可
|
||||
|
||||
4. 修改[your project]/plugins/android.json生成脚本的JPUSH_APPKEY字段
|
||||
|
||||
"xml": "<meta-data android:name=\"JPUSH_APPKEY\" android:value=\"your appkey in JPush Portal\" />",
|
||||
|
||||
4. 执行 cordova build android 使修改的`JPUSH_APPKEY`写入AndroidManifest.xml文件
|
||||
|
||||
> 温馨提示:如果使用eclipse来生成安装包,步骤2与步骤3可省略。直接在AndroidManifest.xml文件中修改JPUSH_APPKEY即可
|
||||
|
||||
5. 在cn.jpush.phonegap的JPushPlugin.java文件开始处,`import your.package.name.R;`
|
||||
|
||||
|
||||
|
||||
|
||||
5. 执行 cordova build android 使修改的`JPUSH_APPKEY`写入AndroidManifest.xml文件
|
||||
6. 在js中调用函数 `window.plugins.jPushPlugin.init();` 初始化jpush sdk
|
||||
|
||||
|
||||
|
||||
@ -69,6 +71,7 @@
|
||||
UIRemoteNotificationTypeSound |
|
||||
UIRemoteNotificationTypeAlert)
|
||||
categories:nil];
|
||||
}
|
||||
#else
|
||||
//categories 必须为nil
|
||||
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
||||
@ -281,3 +284,38 @@
|
||||
eclipse中phonegap工程import之后出现:`Type CallbackContext cannot be resolved to a type`
|
||||
解决方案:eclipse中右键单击工程名,Build Path->Config Build Path->Projects->选中 工程名称-CordovaLib->点击 add
|
||||
|
||||
### API说明
|
||||
|
||||
插件的API集中在JPushPlugin.js文件中,这个文件的位置如下
|
||||
|
||||
* android:[YOUR__ANDROID_PROJECT]/assets/www/plugins/cn.jpush.phonegap.JPushPlugin/www
|
||||
* iOS:[YOUR_iOS_PROJEcT]/www/plugins/cn.jpush.phonegap.JPushPlugin/www
|
||||
|
||||
这里只说明public的函数
|
||||
|
||||
#### API - startLogPageView,stopLogPageView,beginLogPageView
|
||||
|
||||
本 API 用于“用户指定页面使用时长”的统计,并上报到服务器,在 Portal 上展示给开发者。页面统计集成正确,才能够获取正确的页面访问路径、访问深度(PV)的数据。
|
||||
|
||||
##### 接口定义
|
||||
JPushPlugin.prototype.startLogPageView = function(data)
|
||||
JPushPlugin.prototype.stopLogPageView = function(data)
|
||||
|
||||
|
||||
|
||||
#####使用平台
|
||||
iOS
|
||||
|
||||
#####参数说明
|
||||
无参数
|
||||
|
||||
#####调用说明
|
||||
|
||||
#####返回值说明
|
||||
无
|
||||
|
||||
#####代码示例
|
||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,19 @@
|
||||
[APService stopLogPageView:pageName];
|
||||
}
|
||||
|
||||
}
|
||||
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command{
|
||||
NSArray *arguments=command.arguments;
|
||||
if (!arguments||[arguments count]<2) {
|
||||
NSLog(@"beginLogPageView argument error");
|
||||
return ;
|
||||
}
|
||||
NSString * pageName=[arguments objectAtIndex:0];
|
||||
int duration=[[arguments objectAtIndex:0]intValue];
|
||||
if (pageName) {
|
||||
[APService beginLogPageView:pageName duration:duration];
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setBadge:(CDVInvokedUrlCommand*)command{
|
||||
NSArray *argument=command.arguments;
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
var JPushPlugin = function(){
|
||||
};
|
||||
//private plugin function
|
||||
|
||||
JPushPlugin.prototype.isPlatformIOS = function(){
|
||||
return device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch" || device.platform == "iOS"
|
||||
@ -15,6 +16,7 @@ JPushPlugin.prototype.call_native = function(name, args, callback){
|
||||
ret = cordova.exec(callback,this.error_callback,'JPushPlugin',name,args);
|
||||
return ret;
|
||||
}
|
||||
//public plugin function
|
||||
|
||||
JPushPlugin.prototype.startLogPageView = function(data){
|
||||
if(this.isPlatformIOS()){
|
||||
@ -28,6 +30,12 @@ JPushPlugin.prototype.stopLogPageView = function(data){
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.beginLogPageView = function(pageName,duration){
|
||||
if(this.isPlatformIOS()){
|
||||
this.call_native( "beginLogPageView",[pageName,duration],null);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setTagsWithAlias = function(tags,alias){
|
||||
try{
|
||||
if(tags==null){
|
||||
|
Loading…
Reference in New Issue
Block a user