fix: 修复检测包是否安装闪退
This commit is contained in:
parent
14285ab63e
commit
1adb7d11d1
|
|
@ -26,11 +26,6 @@
|
|||
<uses-permission android:name="com.miui.personalassistant.permission.FAVORITE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
||||
<queries>
|
||||
<package android:name="com.baidu.tieba" />
|
||||
<package android:name="com.baidu.tieba_mini" />
|
||||
</queries>
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
android:largeScreens="true"
|
||||
|
|
@ -49,6 +44,7 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<activity
|
||||
android:name=".activities.AppFontSizeActivity"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,12 @@ package com.huanchengfly.tieba.post.utils
|
|||
import android.content.Context
|
||||
|
||||
fun Context.isPackageInstalled(packageName: String): Boolean {
|
||||
return packageManager.getPackageInfo(packageName, 0) != null
|
||||
return try {
|
||||
packageManager.getPackageInfo(packageName, 0)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.isAnyPackageInstalled(packages: Array<String>): Boolean {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data-extraction-rules>
|
||||
<cloud-backup></cloud-backup>
|
||||
</data-extraction-rules>
|
||||
Loading…
Reference in New Issue