openinstall的cordova插件

openinstall提供cordova插件支持,让写cordova的工程师能轻松的对接集成openinstall,,实现业务需求,助力推广。
如何对接?参考官方文档

安装插件

cordova plugin add cordova-plugin-openinstall --variable OPENINSTALL_APPKEY=[appkey] --variable OPENINSTALL_SCHEME=[scheme]

调用API
获取安装参数

window.openinstall.getInstall(function(data){
    console.log('openinstall.getInstall success: ' + data);
}, function(msg){
    console.log('openinstall.getInstall error: ' + msg);
});

也可传入一个整形数值,单位秒,指定时间未返回将超时

window.openinstall.getInstall(function(data){
    console.log('openinstall.getInstall success: ' + data);
}, function(msg){
    console.log('openinstall.getInstall error: ' + msg);
}, 10);

成功回调的data数据格式

{"channel": "渠道号", "data": "自定义数据"}

重点内容
拉起参数获取
调用以下代码注册拉起回调,应尽早调用。如在 java deviceready事件回调之时注册

window.openinstall.registerWakeUpHandler(function(data){
  console.log("openinstall.wakeup success : channel=" + data.channel + ", data=" + data.data);
}, function(msg){
  console.log("openinstall.wakeup error : " + msg)
});

**注意:**对于 iOS,为确保能正常跳转,AppID 必须开启 Associated Domains 功能,请到苹果开发者网站,选择 Certificate, Identifiers & Profiles,选择相应的 AppID,开启 Associated Domains。注意:当 AppID 重新编辑过之后,需要更新相应的 mobileprovision 证书。(详细步骤请参考openinstall官方文档)

注册上报

window.openinstall.reportRegister();

效果点统计

window.openinstall.reportEffectPoint("effect_test", 1);

第一个参数为“效果点ID”,字符串类型
第二个参数为“效果点值”,数字类型

测试
好了,集成这时候就完毕了,打包导出包到后台测试(以Android包为例子)
这里写图片描述

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值