Commit b7e96935 authored by 汪林玲's avatar 汪林玲

android整理完成

parent 645a1324
{
"dart.flutterSdkPath": "/Users/qiaomeng/flutter_2.2.2",
}
\ No newline at end of file
......@@ -92,18 +92,34 @@ public class UmengCommonSdkPlugin implements FlutterPlugin, MethodCallHandler {
String channel = call.argument("channel");
Integer deviceType = call.argument("deviceType");
String pushSecret = call.argument("pushSecret");
boolean mode = call.argument("mode");
boolean process = call.argument("process");
UMConfigure.setProcessEvent(process);
MobclickAgent.setPageCollectionMode(mode?MobclickAgent.PageMode.AUTO:MobclickAgent.PageMode.MANUAL);
UMConfigure.init(mContext, appKey, channel, deviceType, pushSecret);
MobclickAgent.setCatchUncaughtExceptions(true);
result.success(true);
} else if ("onEvent".equals(call.method)) {
// UMConfigure.DEVICE_TYPE_PHONE
String eventId = call.argument("eventId");
Map<String, Object> properties = call.argument("properties");
MobclickAgent.onEventObject(mContext, eventId, properties);
MobclickAgent.setSessionContinueMillis(1000l);
MobclickAgent.setCatchUncaughtExceptions(true);
// MobclickAgent.setSessionContinueMillis(1000l);
result.success(true);
} else {
}else if("onSignIn".equals(call.method)) {
String userId = call.argument("userId");
String provider = call.argument("provider");
if(provider == null){
MobclickAgent.onProfileSignIn(userId);
}else{
MobclickAgent.onProfileSignIn(provider,userId);
}
}else if("onPageStart".equals(call.method)) {
String pageName = call.argument("pageName");
MobclickAgent.onPageStart(pageName);
}else if("onPageEnd".equals(call.method)) {
String pageName = call.argument("pageName");
MobclickAgent.onPageEnd(pageName);
}else {
result.notImplemented();
}
}
......
......@@ -31,12 +31,16 @@ class UmengCommonSdk {
/// [channel] app的渠道,如:应用宝、小米、华为应用商店等
/// [deviceType] 设备类型1、手机、2、...
/// [pushSecret] 密钥
/// [mode] 页面采集模式,true:自动采集 false:手动采集
/// [process] 是否支持子进程采集数据, true:支持 false:不支持
///
static Future<bool> init({
@required String appKey,
@required String channel,
int deviceType = 1,
String pushSecret,
bool mode = true,
bool process = true,
}) async {
final dynamic result = await _channel.invokeMethod('init', {
'appKey': appKey,
......@@ -61,4 +65,42 @@ class UmengCommonSdk {
'properties': properties,
});
}
///
/// 账号统计-登陆
/// [userId] 用户标识
/// [provider] 账号来源。如果用户通过第三方账号登陆,微博,微信等
///
static Future<bool> onSignIn({
@required String userId,
String provider,
}) async {
return await _channel.invokeMethod('onSignIn', {
'userId': userId,
'provider': provider,
});
}
///
/// 账号统计-退出登陆
///
static Future<bool> onSignOff() async {
return await _channel.invokeMethod('onSignOff');
}
///
/// 页面采集-打开
/// [pageName] 采集页面的名称
///
static Future<bool> onPageStart({@required String pageName}) async {
return await _channel.invokeMethod('onPageStart', {'pageName': pageName});
}
////
/// 页面采集关闭
/// [pageName] 采集页面的名称
///
static Future<bool> onPageEnd({@required String pageName}) async {
return await _channel.invokeMethod('onPageEnd', {'pageName': pageName});
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment