Commit 22bdc9a4 authored by liusheng's avatar liusheng

添加bugly

parent 5b98f8d8
......@@ -120,4 +120,7 @@ dependencies {
annotationProcessor("com.github.bumptech.glide:compiler:4.11.0")
implementation("com.github.open-android:JieCaoVideoPlayer:0.1.0")
implementation("com.tencent.bugly:crashreport_upgrade:1.5.23")//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0
implementation ("com.tencent.bugly:nativecrashreport:3.9.2")//其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.2.0
}
\ No newline at end of file
......@@ -165,3 +165,8 @@
-dontwarn org.eclipse.jdt.annotation.**
-dontwarn c.t.**
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
-keep class android.support.**{*;}
......@@ -3,11 +3,15 @@ package com.ccwangluo.accelerator
import android.app.Application
import android.content.Context
import android.content.res.Configuration
import android.os.Environment
import androidx.multidex.MultiDex
import com.ccwangluo.accelerator.ui.MainActivity
import com.ccwangluo.accelerator.utils.PhoneUtils
import com.github.shadowsocks.Core
import com.hjq.toast.ToastUtils
import com.tencent.bugly.Bugly
import com.tencent.bugly.BuglyStrategy
import com.tencent.bugly.beta.Beta
import com.tencent.map.geolocation.TencentLocationManager
import com.tencent.mmkv.MMKV
import com.xuexiang.xpage.PageConfig
......@@ -17,6 +21,7 @@ import com.xuexiang.xpage.base.XPageActivity
class App : Application(), androidx.work.Configuration.Provider by Core {
override fun onCreate() {
super.onCreate()
initBugly()
PageConfig.getInstance() // //页面注册,默认不设置的话使用的就是自动注册
// .setPageConfiguration(new AutoPageConfiguration())
.debug("PageLog") //开启调试
......@@ -30,6 +35,110 @@ class App : Application(), androidx.work.Configuration.Provider by Core {
MMKV.initialize(this)
}
fun initBugly(){
/**
* true表示app启动自动初始化升级模块; false不会自动初始化;
* 开发者如果担心sdk初始化影响app启动速度,可以设置为false,
* 在后面某个时刻手动调用Beta.init(getApplicationContext(),false);
*/
/***** Beta高级设置 */
/**
* true表示app启动自动初始化升级模块; false不会自动初始化;
* 开发者如果担心sdk初始化影响app启动速度,可以设置为false,
* 在后面某个时刻手动调用Beta.init(getApplicationContext(),false);
*/
Beta.autoInit = true
/**
* true表示初始化时自动检查升级; false表示不会自动检查升级,需要手动调用Beta.checkUpgrade()方法;
*/
/**
* true表示初始化时自动检查升级; false表示不会自动检查升级,需要手动调用Beta.checkUpgrade()方法;
*/
Beta.autoCheckUpgrade = true
/**
* 设置升级检查周期为60s(默认检查周期为0s),60s内SDK不重复向后台请求策略);
*/
/**
* 设置升级检查周期为60s(默认检查周期为0s),60s内SDK不重复向后台请求策略);
*/
Beta.upgradeCheckPeriod = (60 * 1000).toLong()
/**
* 设置启动延时为1s(默认延时3s),APP启动1s后初始化SDK,避免影响APP启动速度;
*/
/**
* 设置启动延时为1s(默认延时3s),APP启动1s后初始化SDK,避免影响APP启动速度;
*/
Beta.initDelay = (1 * 1000).toLong()
/**
* 设置通知栏大图标,largeIconId为项目中的图片资源;
*/
/**
* 设置通知栏大图标,largeIconId为项目中的图片资源;
*/
Beta.largeIconId = R.mipmap.tt_logo
/**
* 设置状态栏小图标,smallIconId为项目中的图片资源Id;
*/
/**
* 设置状态栏小图标,smallIconId为项目中的图片资源Id;
*/
Beta.smallIconId = R.mipmap.tt_logo
/**
* 设置更新弹窗默认展示的banner,defaultBannerId为项目中的图片资源Id;
* 当后台配置的banner拉取失败时显示此banner,默认不设置则展示“loading“;
*/
/**
* 设置更新弹窗默认展示的banner,defaultBannerId为项目中的图片资源Id;
* 当后台配置的banner拉取失败时显示此banner,默认不设置则展示“loading“;
*/
Beta.defaultBannerId = R.mipmap.tt_logo
/**
* 设置sd卡的Download为更新资源保存目录;
* 后续更新资源会保存在此目录,需要在manifest中添加WRITE_EXTERNAL_STORAGE权限;
*/
/**
* 设置sd卡的Download为更新资源保存目录;
* 后续更新资源会保存在此目录,需要在manifest中添加WRITE_EXTERNAL_STORAGE权限;
*/
Beta.storageDir = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
/**
* 已经确认过的弹窗在APP下次启动自动检查更新时会再次显示;
*/
/**
* 已经确认过的弹窗在APP下次启动自动检查更新时会再次显示;
*/
Beta.showInterruptedStrategy = true
/**
* 只允许在MainActivity上显示更新弹窗,其他activity上不显示弹窗; 不设置会默认所有activity都可以显示弹窗;
*/
/**
* 只允许在MainActivity上显示更新弹窗,其他activity上不显示弹窗; 不设置会默认所有activity都可以显示弹窗;
*/
Beta.canShowUpgradeActs.add(MainActivity::class.java)
/***** Bugly高级设置 *****/
/***** Bugly高级设置 */
val strategy = BuglyStrategy()
/**
* 设置app渠道号
*/
/**
* 设置app渠道号
*/
//strategy.appChannel = com.qq.bugly.beta.demo.DemoApplication.APP_CHANNEL
/***** 统一初始化Bugly产品,包含Beta *****/
/***** 统一初始化Bugly产品,包含Beta */
//Bugly.init(this, com.qq.bugly.beta.demo.DemoApplication.APP_ID, true, strategy)
//Beta.upgradeDialogLayoutId = R.layout.dialog_app_upgrade
Bugly.init(this, "e030f74df5", true)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
Core.updateNotificationChannels()
......
......@@ -22,6 +22,7 @@ import com.ccwangluo.cc_quickly.utils.SettingSPUtils
import com.github.shadowsocks.http.HttpConfig
import com.github.shadowsocks.bg.BaseService
import com.hjq.toast.ToastUtils
import com.tencent.bugly.beta.Beta
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar
import com.xuexiang.xui.utils.ViewUtils
......@@ -190,6 +191,8 @@ class AccelertorFragment : XPageFragment() {
}
}
binding.btnQuick.setOnClickListener {
Beta.checkUpgrade(true,false)
accelertorViewModel.accState.value?.let {
if (it.canStop) {
context?.let {
......@@ -201,6 +204,7 @@ class AccelertorFragment : XPageFragment() {
}
return@setOnClickListener
}
}
if (!LoginUtils.hasToken()) {
LoginUtils.login(this, {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:tag="beta_upgrade_banner"
android:layout_width="wrap_content"
android:src="@mipmap/banner"
android:layout_height="wrap_content"/>
<TextView
android:tag="beta_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:tag="beta_upgrade_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:tag="beta_upgrade_feature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:tag="beta_cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:tag="beta_confirm_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
\ No newline at end of file
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