Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
umeng_common_flutter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
flutter-plugin
umeng_common_flutter
Commits
b7e96935
Commit
b7e96935
authored
Sep 03, 2021
by
汪林玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android整理完成
parent
645a1324
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
5 deletions
+66
-5
.vscode/settings.json
.vscode/settings.json
+3
-0
android/src/main/java/com/umeng/umeng_common_sdk/UmengCommonSdkPlugin.java
...java/com/umeng/umeng_common_sdk/UmengCommonSdkPlugin.java
+21
-5
lib/umeng_common_sdk.dart
lib/umeng_common_sdk.dart
+42
-0
No files found.
.vscode/settings.json
0 → 100644
View file @
b7e96935
{
"dart.flutterSdkPath"
:
"/Users/qiaomeng/flutter_2.2.2"
,
}
\ No newline at end of file
android/src/main/java/com/umeng/umeng_common_sdk/UmengCommonSdkPlugin.java
View file @
b7e96935
...
...
@@ -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
(
1000
l
);
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
();
}
}
...
...
lib/umeng_common_sdk.dart
View file @
b7e96935
...
...
@@ -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
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment