Android SDK API
最近更新:2023-11-03
展开全部

Android SDK API

SDK 接口说明

  • JOperateInterface,包含 SDK 所有接口。

SDK 初始化

支持的版本

开始支持的版本: 2.0.8

接口定义

  • initialize()
    • 接口说明:
      • 初始化接口。建议在 Application 的 onCreate 中调用

调用示例

JOperateInterface.getInstance(getApplicationContext()).initialize();
          JOperateInterface.getInstance(getApplicationContext()).initialize();

        
此代码块在浮窗中显示

SDK 初始化(失效)

支持的版本

开始支持的版本: 2.0.0 开始失效的版本: 2.0.8

接口定义

  • init()
    • 接口说明:
      • 初始化接口。建议在 Application 的 onCreate 中调用
      • 开始失效的版本: 2.0.8

调用示例

JOperateInterface.getInstance(getApplicationContext()).init();
          JOperateInterface.getInstance(getApplicationContext()).init();

        
此代码块在浮窗中显示

启用业务功能

支持的版本

开始支持的版本: 2.0.8

接口定义

  • operationStart()
    • 接口说明:
      • 启用行为分析及用户画像接口。建议在 Application 的 onCreate 中调用
      • operationStart接口是其他接口的开始接口,所以必须先调用operationStart接口,才能调用其他接口
      • 调用该接口,启用行为分析及用户画像功能,则会开始收集上报SDK业务功能对应的用户信息

调用示例

JOperateInterface.getInstance(getApplicationContext()).operationStart();
          JOperateInterface.getInstance(getApplicationContext()).operationStart();

        
此代码块在浮窗中显示

设置 Debug 模式

支持的版本

开始支持的版本: 2.0.0

接口定义

  • setDebug(boolean enable)
    • 接口说明:
      • 设置是否开启 debug 模式。true 则会打印更多的日志信息。建议在 init 接口之前调用。
    • 参数说明:
      • enable:debug 开关

调用示例

JOperateInterface.setDebug(true);
          JOperateInterface.setDebug(true);

        
此代码块在浮窗中显示

设置用户标识

支持的版本

开始支持的版本: 2.0.0

接口定义

  • login(JSONObject property, final CallBack callBack)
    • 接口说明:
      • 设置用户标识,如:用户会员卡号。
    • 参数说明:
      • property:用户标识
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见 msg 参数描述
      • msg:原因描述

调用示例

JSONObject property = new JSONObject(); try {property.put("key1", "fffff");// 用户一级标识 property.put("key2", "13407589860");// 用户二级标识 } catch (Throwable e) {e.printStackTrace(); } JOperateInterface.getInstance(getApplicationContext()).login(property, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {Log.d(TAG, "login code:" + code + ",msg:" + msg); } });
                  JSONObject property = new JSONObject();
        try {property.put("key1", "fffff");// 用户一级标识
            property.put("key2", "13407589860");// 用户二级标识
        } catch (Throwable e) {e.printStackTrace();
        }
        JOperateInterface.getInstance(getApplicationContext()).login(property, new JOperateInterface.CallBack() {
            @Override
            public void onCallBack(int code, String msg) {Log.d(TAG, "login code:" + code + ",msg:" + msg);
            }
        });

        
此代码块在浮窗中显示

设置用户联系方式

当用户的联系方式发生变更时,可使用本接口更新用户在「触达通道」-「联系标签」的「联系方式」。

支持的版本

开始支持的版本: 2.0.0

接口定义

  • setChannel(JSONObject data, final CallBack callBack)
    • 接口说明:
      • 为指定「通道ID」下的「联系标签」设置用户的「联系方式」。
      • 初始联系标签名称为「默认联系」,若要设置自定义的名称则需要先在平台界面上添加 联系标签
      • 支持同时设置多个「联系标签」的值。
      • 设置「APP通知」的「联系标签」时,其值须为该用户的 Registration ID
      • 设置「短信」的「联系标签」时,其值须为11位数字(手机号码格式)
    • 参数说明:
      • data:设置多个通道
      • 结构为 {触达通道 id:{ 联系标签: 联系方式}}
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见 msg 参数描述
      • msg:原因描述

调用示例

  • 项目所添加的触达通道,均依赖于开发者主动为每个用户设置相关的通道值,才能正常发送消息。
  • 当用户的触达通道信息发生变更时需同步更新触达通道值。如:用户绑定手机号码发生变化时,需同步设置短信触达通道值。
JSONObject property = new JSONObject(); try {JSONObject contact = new JSONObject(); contact.put("联系标签", "联系方式"); property.put("后台创建的触达通道 ID", contact); } catch (Throwable e) {e.printStackTrace(); } JOperateInterface.getInstance(getApplicationContext()).setChannel(property, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {Log.d(TAG, "setChannel code:" + code + ",msg:" + msg); } });
                  JSONObject property = new JSONObject();
        try {JSONObject contact = new JSONObject();
            contact.put("联系标签", "联系方式");
            property.put("后台创建的触达通道 ID", contact);
        } catch (Throwable e) {e.printStackTrace();
        }
        JOperateInterface.getInstance(getApplicationContext()).setChannel(property, new JOperateInterface.CallBack() {
            @Override
            public void onCallBack(int code, String msg) {Log.d(TAG, "setChannel code:" + code + ",msg:" + msg);
            }
        });

        
此代码块在浮窗中显示

上报自定义事件

调用该接口前,需要先在控制台创建元事件,详情参考 创建元事件

支持的版本

开始支持的版本: 2.0.0

接口定义

  • onEvent(String eventKey, JSONObject property)
    • 接口说明:
      • 自定义事件
    • 参数说明:
      • eventKey:事件名称 key
      • property:事件其他属性

调用示例

JSONObject property = new JSONObject(); String eventKey = "你的事件名 key"; try {property.put("你的属性名 key", 0); property.put("你的属性名 key", "你好"); } catch (Throwable e) {e.printStackTrace(); } JOperateInterface.getInstance(getApplicationContext()).onEvent(eventKey, property);
          JSONObject property = new JSONObject();

        String eventKey = "你的事件名 key";
        try {property.put("你的属性名 key", 0);
            property.put("你的属性名 key", "你好");
        } catch (Throwable e) {e.printStackTrace();
        }
        JOperateInterface.getInstance(getApplicationContext()).onEvent(eventKey, property);

        
此代码块在浮窗中显示

获取 CUID

支持的版本

开始支持的版本: 2.0.0

接口定义

  • getCuid()
    • 接口说明:
      • 获取 cuid。表示用户唯一 id

调用示例

JOperateInterface.getInstance(getApplicationContext()).getCuid();
          JOperateInterface.getInstance(getApplicationContext()).getCuid();

        
此代码块在浮窗中显示

获取 SDK 版本号

支持的版本

开始支持的版本: 2.0.0

接口定义

  • getVersion()
    • 接口说明:
      • 获取当前 sdk 版本号

调用示例

JOperateInterface.getInstance(getApplicationContext()).getVersion();
          JOperateInterface.getInstance(getApplicationContext()).getVersion();

        
此代码块在浮窗中显示

注册静态公有属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • registerSuperProperties(JSONObject properties)
    • 接口说明:
      • 注册静态公有属性,后面所有上报事件数据都会包含该属性,该属性保存在本地,设置长期有效。
    • 参数说明:
      • properties: 静态公有属性

调用示例

try {JSONObject properties = new JSONObject(); properties.put("你的属性名","你的属性值"); properties.put("你的属性名 2","你的属性值 2"); properties.put("你的属性名 3","你的属性值 3"); JOperateInterface.getInstance(getApplicationContext()).registerSuperProperties(properties); } catch (Throwable e) {e.printStackTrace(); }
          try {JSONObject properties = new JSONObject();
    properties.put("你的属性名","你的属性值");
    properties.put("你的属性名 2","你的属性值 2");
    properties.put("你的属性名 3","你的属性值 3");
    JOperateInterface.getInstance(getApplicationContext()).registerSuperProperties(properties);
} catch (Throwable e) {e.printStackTrace();
}

        
此代码块在浮窗中显示

清除静态公有属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • clearSuperProperties()
    • 接口说明:
      • 清除静态公有属性

调用示例

JOperateInterface.getInstance(getApplicationContext()).clearSuperProperties();
          JOperateInterface.getInstance(getApplicationContext()).clearSuperProperties();

        
此代码块在浮窗中显示

清除某个静态公有属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • unregisterSuperProperty(String superPropertyName)
    • 接口说明:
      • 清除某个静态公有属性
    • 参数说明:
      • superPropertyName: 静态公有属性名

调用示例

JOperateInterface.getInstance(getApplicationContext()).unregisterSuperProperty("你想要清除的静态公有属性名");
          JOperateInterface.getInstance(getApplicationContext()).unregisterSuperProperty("你想要清除的静态公有属性名");

        
此代码块在浮窗中显示

注册动态公有属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • registerDynamicSuperProperties(DynamicSuperProperties dynamicSuperProperties)
    • 接口说明:
      • 注册动态公有属性,后面所有上报事件数据都会包含该接口返回的属性,该属性仅当次设置有效。
    • 参数说明:
      • dynamicSuperProperties:通过这个接口类返回动态公有属性。

调用示例

JOperateInterface.getInstance(getApplicationContext()).registerDynamicSuperProperties(new JOperateInterface.DynamicSuperProperties() { @Override public JSONObject getDynamicSuperProperties() {JSONObject properties = new JSONObject(); try {properties.put("你的属性名", "你的属性值"); properties.put("你的属性名 2", "你的属性值 2"); properties.put("你的属性名 3", "你的属性值 3"); } catch (Throwable e) {e.printStackTrace(); } return properties; } });
          JOperateInterface.getInstance(getApplicationContext()).registerDynamicSuperProperties(new JOperateInterface.DynamicSuperProperties() {
    @Override
    public JSONObject getDynamicSuperProperties() {JSONObject properties = new JSONObject();
        try {properties.put("你的属性名", "你的属性值");
            properties.put("你的属性名 2", "你的属性值 2");
            properties.put("你的属性名 3", "你的属性值 3");

        } catch (Throwable e) {e.printStackTrace();
        }
        return properties;
    }
});

        
此代码块在浮窗中显示

设置 UTM 属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • setUtmProperties(final JSONObject properties)
    • 接口说明:
      • 设置 UTM 属性
    • 参数说明:
      • 获取极光 RID
      • UTM 属性为预置属性,目前能够设置 UTM 属性为:
        • utm_source 广告系列来源
        • utm_medium 广告系列媒介
        • utm_term 广告系列字词
        • utm_content 广告系列内容
        • utm_campaign 广告系列名称

调用示例

try {JSONObject properties = new JSONObject(); properties.put("utm_source","你的属性值"); JOperateInterface.getInstance(getApplicationContext()).setUtmProperties(properties); } catch (Throwable e) {e.printStackTrace(); }
          try {JSONObject properties = new JSONObject();
    properties.put("utm_source","你的属性值");
    JOperateInterface.getInstance(getApplicationContext()).setUtmProperties(properties);
} catch (Throwable e) {e.printStackTrace();
}

        
此代码块在浮窗中显示

设置用户属性

调用该接口前,需要先在控制台创建用户属性,详情参考 创建用户属性

设置覆盖方式的用户属性

  • profileSet(final JSONObject properties, final CallBack callBack)
    • 接口说明:
      • 设置覆盖方式的用户属性。
      • 仅保存最新上报的数据,覆盖历史数据,如:用户会员等级。
    • 参数说明:
      • properties: 用户属性
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
try {JSONObject properties = new JSONObject(); properties.put("你的用户属性名","你的属性值"); properties.put("你的用户属性名 2","你的属性值 2"); properties.put("你的用户属性名 3","你的属性值 3"); JOperateInterface.getInstance(getApplicationContext()).profileSet(properties, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}}); } catch (Throwable e) {e.printStackTrace(); }
          try {JSONObject properties = new JSONObject();
    properties.put("你的用户属性名","你的属性值");
    properties.put("你的用户属性名 2","你的属性值 2");
    properties.put("你的用户属性名 3","你的属性值 3");
    JOperateInterface.getInstance(getApplicationContext()).profileSet(properties, new JOperateInterface.CallBack() {
        @Override
        public void onCallBack(int code, String msg) {}});
} catch (Throwable e) {e.printStackTrace();
}

        
此代码块在浮窗中显示
  • profileSet(String property, Object value, CallBack callBack)
    • 接口说明:
      • 设置覆盖方式用户属性。
      • 仅保存最新上报的数据,覆盖历史数据,如:用户会员等级。
    • 参数说明:
      • property: 用户属性名
      • value: 用户属性值
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
JOperateInterface.getInstance(getApplicationContext()).profileSet("你的用户属性名","你的属性值", new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          JOperateInterface.getInstance(getApplicationContext()).profileSet("你的用户属性名","你的属性值", new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示

设置仅首次生效的用户属性

  • profileSetOnce(final JSONObject properties, final CallBack callBack)
    • 接口说明:
      • 设置只有第一次生效的用户属性。
      • 仅需设置一次属性,该字段有值时会忽略之后的上报数据,如首次付费时间。
    • 参数说明:
      • properties: 用户属性
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
try {JSONObject properties = new JSONObject(); properties.put("你的用户属性名","你的属性值"); properties.put("你的用户属性名 2","你的属性值 2"); properties.put("你的用户属性名 3","你的属性值 3"); JOperateInterface.getInstance(getApplicationContext()).profileSetOnce(properties, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}}); } catch (Throwable e) {e.printStackTrace(); }
          try {JSONObject properties = new JSONObject();
    properties.put("你的用户属性名","你的属性值");
    properties.put("你的用户属性名 2","你的属性值 2");
    properties.put("你的用户属性名 3","你的属性值 3");
    JOperateInterface.getInstance(getApplicationContext()).profileSetOnce(properties, new JOperateInterface.CallBack() {
        @Override
        public void onCallBack(int code, String msg) {}});
} catch (Throwable e) {e.printStackTrace();
}

        
此代码块在浮窗中显示
  • profileSetOnce(final String property, final Object value, CallBack callBack)
    • 接口说明:
      • 设置只有第一次生效的用户属性。
      • 仅需设置一次属性,该字段有值时会忽略之后的上报数据,如首次付费时间。
    • 参数说明:
      • property: 用户属性名
      • value: 用户属性值
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
      • 调用示例:
JOperateInterface.getInstance(getApplicationContext()).profileSetOnce("你的用户属性名","你的属性值", new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          JOperateInterface.getInstance(getApplicationContext()).profileSetOnce("你的用户属性名","你的属性值", new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示

设置累加方式的用户属性

  • profileIncrement(final Map<String, ? extends Number> properties, CallBack callBack)
    • 接口说明:
      • 设置累加方式的用户属性。
      • 累加所有上报的数据,如累计消费金额。
      • 只能对数值类型的用户属性调用这个接口,否则会被忽略, 如果这个用户属性之前不存在,则初始值当做 0 来处理。
    • 参数说明:
      • properties: 用户属性
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
Map<String,Number> properties = new HashMap(); properties.put("你的用户属性名",1); properties.put("你的用户属性名 2",2); properties.put("你的用户属性名 3",3); JOperateInterface.getInstance(getApplicationContext()).profileIncrement(properties, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          Map<String,Number> properties = new HashMap();
properties.put("你的用户属性名",1);
properties.put("你的用户属性名 2",2);
properties.put("你的用户属性名 3",3);
JOperateInterface.getInstance(getApplicationContext()).profileIncrement(properties, new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示
  • profileIncrement(final String property, final Number value, CallBack callBack)
    • 接口说明:
      • 设置累加方式的用户属性。
      • 累加所有上报的数据,如累计消费金额。
      • 只能对数值类型的用户属性调用这个接口,否则会被忽略, 如果这个用户属性之前不存在,则初始值当做 0 来处理。
    • 参数说明:
      • property: 用户属性名
      • value: 用户属性值
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
JOperateInterface.getInstance(getApplicationContext()).profileIncrement("你的用户属性名",1, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          JOperateInterface.getInstance(getApplicationContext()).profileIncrement("你的用户属性名",1, new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示

设置追加方式的用户属性

  • profileAppend(final String property, final String value, CallBack callBack)
    • 接口说明:
      • 设置追加方式的用户属性。
      • 可持续增加该集合元素,元素入库去重处理,若已存在ABC,追加CD,最终为ABCD,如用户点赞的新闻。
    • 参数说明:
      • property: 用户属性名
      • value: 用户属性值
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
JOperateInterface.getInstance(getApplicationContext()).profileAppend("你的用户属性名","你的用户属性值", new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          JOperateInterface.getInstance(getApplicationContext()).profileAppend("你的用户属性名","你的用户属性值", new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示
  • profileAppend(final String property, final Set values, CallBack callBack)
    • 接口说明:
      • 设置追加方式的用户属性。
      • 可持续增加该集合元素,元素入库去重处理,若已存在ABC,追加CD,最终为ABCD,如用户点赞的新闻。
    • 参数说明:
      • property: 用户属性名
      • value: 用户属性值
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述
    • 调用示例:
Set<String> properties = new HashSet<>(); properties.add("你的用户属性值"); properties.add("你的用户属性值 2"); properties.add("你的用户属性值 3"); JOperateInterface.getInstance(getApplicationContext()).profileAppend("你的用户属性名",properties, new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          Set<String> properties = new HashSet<>();
properties.add("你的用户属性值");
properties.add("你的用户属性值 2");
properties.add("你的用户属性值 3");
JOperateInterface.getInstance(getApplicationContext()).profileAppend("你的用户属性名",properties, new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示

删除用户属性

支持的版本

开始支持的版本: 2.0.0

接口定义

  • profileUnset(final String property, final CallBack callBack)
    • 接口说明:
      • 清除对应的用户属性
    • 参数说明:
      • property: 用户属性名
      • callBack:接口回调
    • 返回说明:
      onCallBack(int code, String msg)
      • code: 返回码,0 代表获取成功,-1 为失败,详见错误码描述
      • msg:原因描述

调用示例

JOperateInterface.getInstance(getApplicationContext()).profileUnset("你的用户属性名", new JOperateInterface.CallBack() { @Override public void onCallBack(int code, String msg) {}});
          JOperateInterface.getInstance(getApplicationContext()).profileUnset("你的用户属性名", new JOperateInterface.CallBack() {
    @Override
    public void onCallBack(int code, String msg) {}});

        
此代码块在浮窗中显示

统计事件时长

支持的版本

开始支持的版本: 2.0.0

接口定义

  • String onEventTimerStart(String eventName)
    • 接口说明:
      • 事件开始计时
    • 参数说明:
      • eventName: 事件名
    • 返回说明:
      • eventNameKey: 返回事件名 key,用于后续事件统计
  • onEventTimerPause(String eventNameKey)
    • 接口说明:
      • 事件暂停计时
    • 参数说明:
      • eventNameKey: onEventTimerStart 返回的事件 key
  • onEventTimerResume(String eventNameKey)
    • 接口说明:
      • 事件继续开始计时
    • 参数说明:
      • eventNameKey: onEventTimerStart 返回的事件 key
  • onEventTimerEnd(String eventNameKey)
    • 接口说明:
      • 事件结束计时,并上报
    • 参数说明:
      • eventNameKey: onEventTimerStart 返回的事件 key
  • onEventTimerEnd(String eventNameKey, final JSONObject properties)
    • 接口说明:
      • 事件结束计时,并上报
    • 参数说明:
      • eventNameKey: onEventTimerStart 返回的事件 key
      • properties: 事件的其他属性
  • removeTimer(String eventNameKey)
    • 接口说明:
      • 清除关闭该事件,比如统计到一半时不再需要统计了
    • 参数说明:
      • eventNameKey: onEventTimerStart 返回的事件 key
  • clearTrackTimer()
    • 接口说明:
      • 清除关闭所有事件,比如统计到一半时不再需要统计了

调用示例

JSONObject properties = new JSONObject(); properties.put("你的用户属性名","你的属性值"); properties.put("你的用户属性名 2","你的属性值 2"); properties.put("你的用户属性名 3","你的属性值 3"); JOperateInterface instance = JOperateInterface.getInstance(getApplicationContext()); String eventNameKey = instance.onEventTimerStart("你的事件名"); instance.onEventTimerPause(eventNameKey); instance.onEventTimerResume(eventNameKey); instance.onEvent(eventNameKey,properties);
          JSONObject properties = new JSONObject();
properties.put("你的用户属性名","你的属性值");
properties.put("你的用户属性名 2","你的属性值 2");
properties.put("你的用户属性名 3","你的属性值 3");

JOperateInterface instance = JOperateInterface.getInstance(getApplicationContext());
String eventNameKey = instance.onEventTimerStart("你的事件名");
instance.onEventTimerPause(eventNameKey);
instance.onEventTimerResume(eventNameKey);
instance.onEvent(eventNameKey,properties);

        
此代码块在浮窗中显示

查看上报外围字段

支持的版本

开始支持的版本: 2.0.0

接口定义

  • getPeripheralProperty()
    • 接口说明:
      • 查看上报外围字段

调用示例

JSONObject peripheralProperty = JOperateInterface.getInstance(getApplicationContext()).getPeripheralProperty();
          JSONObject peripheralProperty =  JOperateInterface.getInstance(getApplicationContext()).getPeripheralProperty();

        
此代码块在浮窗中显示

获取外围字段权限设置(获取当前设备信息)

注:setPermissionsAll 接口优先级高于 setPermissionsLocation 和 setPermissionsMac。

支持的版本

开始支持的版本: 2.0.0

接口定义

  • setPermissionsAll(boolean b)
    • 接口说明:
      • 设置是否可获取设备信息总开关,默认开
    • 参数说明:
      • b: true 为开,false 为关
  • setPermissionsLocation(boolean b)
    • 接口说明:
      • 设置是否可获取地理位置信息,gps,wifi 名,默认使用 setPermissionsAll 的值
    • 参数说明:
      • b: true 为开,false 为关
    • 返回说明:
  • setPermissionsMac(boolean b)
    • 接口说明:
      • 设置是否可获取 mac 信息,默认使用 setPermissionsAll 的值
    • 参数说明:
      • b: true 为开,false 为关
    • 返回说明:

调用示例

JOperateInterface.getInstance(getApplicationContext()).setPermissionsAll(true); JOperateInterface.getInstance(getApplicationContext()).setPermissionsLocation(true); JOperateInterface.getInstance(getApplicationContext()).setPermissionsMac(true);
          JOperateInterface.getInstance(getApplicationContext()).setPermissionsAll(true);
JOperateInterface.getInstance(getApplicationContext()).setPermissionsLocation(true);
JOperateInterface.getInstance(getApplicationContext()).setPermissionsMac(true);

        
此代码块在浮窗中显示

数据采集控制

支持的版本

开始支持的版本: 2.0.9

接口定义

  • setCollectControl(JOperateDataControlConfig control)
    • 接口说明:
      • 采集权限设置,为了确保您使用极光运营增长的良好效果,我们强烈建议您全部采集。

调用示例

JOperateCollectControl.Builder builder = new JOperateCollectControl.Builder(); builder.gps(true);//true 可采集gps JOperateCollectControl jOperateCollectControl = builder.build(); JOperateInterface.getInstance(getApplicationContext()).setCollectControl(jOperateCollectControl);
                  JOperateCollectControl.Builder builder = new JOperateCollectControl.Builder();
        builder.gps(true);//true 可采集gps
        JOperateCollectControl jOperateCollectControl = builder.build();
        JOperateInterface.getInstance(getApplicationContext()).setCollectControl(jOperateCollectControl);

        
此代码块在浮窗中显示
文档内容是否对您有帮助?

Copyright 2011-2022, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 深圳市和讯华谷信息技术有限公司

在文档中心打开