生活随笔
收集整理的這篇文章主要介紹了
android友盟统计的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.依賴
根Build.gradle
添加:maven { url ‘https://repo1.maven.org/maven2/’ }
全部代碼,包含阿里云
buildscript
{repositories
{maven
{ url
'https://repo1.maven.org/maven2/' }maven
{ url
'https://maven.aliyun.com/repository/central'}maven
{ url
'https://maven.aliyun.com/repository/public'}maven
{ url
'https://maven.aliyun.com/repository/public'}maven
{ url
'https://maven.aliyun.com/repository/google'}maven
{ url
'https://maven.aliyun.com/repository/gradle-plugin'}maven
{ url
'https://maven.aliyun.com/repository/spring'}maven
{ url
'https://maven.aliyun.com/repository/spring-plugin'}maven
{ url
'https://maven.aliyun.com/repository/grails-core'}maven
{ url
'https://maven.aliyun.com/repository/apache-snapshots'}maven
{ url
"https://dl.bintray.com/thelasterstar/maven/" }maven
{ url
'https://dl.bintray.com/umsdk/release' }google()jcenter()}dependencies
{classpath
"com.android.tools.build:gradle:4.1.3"}
}
allprojects
{repositories
{maven
{ url
'https://repo1.maven.org/maven2/' }maven
{ url
'https://maven.aliyun.com/repository/central'}maven
{ url
'https://maven.aliyun.com/repository/public'}maven
{ url
'https://maven.aliyun.com/repository/public'}maven
{ url
'https://maven.aliyun.com/repository/google'}maven
{ url
'https://maven.aliyun.com/repository/gradle-plugin'}maven
{ url
'https://maven.aliyun.com/repository/spring'}maven
{ url
'https://maven.aliyun.com/repository/spring-plugin'}maven
{ url
'https://maven.aliyun.com/repository/grails-core'}maven
{ url
'https://maven.aliyun.com/repository/apache-snapshots'}maven
{ url
"https://dl.bintray.com/thelasterstar/maven/" }maven
{ url
'https://dl.bintray.com/umsdk/release' }google()jcenter()maven
{ url
"http://lib.gcssloop.com:8081/repository/gcssloop-central/" }}
}task
clean(type
: Delete
) {delete rootProject
.buildDir
}
// 友盟統計SDKimplementation 'com.umeng.umsdk:common:9.4.0'// 必選implementation 'com.umeng.umsdk:asms:1.2.3'// 必選implementation 'com.umeng.umsdk:apm:1.3.1' // 錯誤分析升級為獨立SDK,看crash數據請一定集成,可選implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可選
2.在application添加key
其中key是自己申請的key(例子:5433fert35t532)
冷啟動
UMConfigure
.preInit(this,BuildConfig
.umeng_app_Key
,BuildConfig
.URL
);
用戶點擊同意后,執行真正的 統計
UMConfigure
.init(HdztwelcomeActivity
.this, BuildConfig
.umeng_app_Key
, BuildConfig
.URL
, UMConfigure
.DEVICE_TYPE_PHONE
, null
);
3.再baseActivity里的onResume,onPause寫東西
@Overrideprotected void onResume() {super.onResume();MobclickAgent
.onResume(this);}@Overrideprotected void onPause() {super.onPause();MobclickAgent
.onPause(this);}
總結
以上是生活随笔為你收集整理的android友盟统计的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。