Commit 207e7c54 authored by jyx's avatar jyx

删除多余申请权限

parent 850bd6b1
......@@ -197,15 +197,13 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
// 65536
implementation 'androidx.multidex:multidex:2.0.1'
// jsbridge
implementation 'com.github.lzyzsd:jsbridge:1.0.4'
//下拉刷新
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-26'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-26'
//类似sharedPreference
implementation 'net.grandcentrix.tray:tray:0.12.0'
// mmkv
implementation 'com.tencent:mmkv-static:1.2.3'
// implementation 'com.tencent:mmkv-static:1.2.3'
// 动画库
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
......@@ -231,8 +229,8 @@ dependencies {
implementation 'com.tencent.bugly:nativecrashreport:3.0'
//其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
// 极光推送
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
// implementation 'cn.jiguang.sdk:jpush:3.6.6'
// implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟
implementation(name: 'oaid_sdk_1.0.23', ext: 'aar')
// 应用管理中心分包
......@@ -241,19 +239,6 @@ dependencies {
implementation(name: 'umeng-asms-armeabi-v1.2.2', ext: 'aar')
implementation(name: 'umeng-apm-armeabi-v1.2.0', ext: 'aar')
// // 穿山甲 GroMore
// // mediation_ad_sdk
// implementation(name: 'mediation_ad_sdk_3.2.0.0', ext: 'aar')
// implementation(name: 'gdt_adapter_4.430.1300.2', ext: 'aar')
// implementation(name: 'ks_adapter_3.3.17.3', ext: 'aar')
// implementation(name: 'pangle_adapter_4.1.0.2.2', ext: 'aar')
// // 穿山甲广告
// implementation(name: 'open_ad_sdk_4.1.0.2', ext: 'aar')
// // 广点通广告 腾讯
// implementation(name: 'GDTSDK.unionNormal.4.430.1300', ext: 'aar')
// // 快手
// implementation(name: 'kssdk-ad-3.3.17', ext: 'aar')
// 穿山甲 GroMore
// mediation_ad_sdk
implementation(name: 'mediation_ad_sdk_3.1.0.1', ext: 'aar')
......
......@@ -9,7 +9,7 @@
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<!-- <uses-permission android:name="android.permission.CALL_PHONE" />-->
<!--读取电话的状态信息的权限-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
......@@ -21,24 +21,24 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.READ_LOGS" />
<!-- <uses-permission android:name="android.permission.WRITE_SETTINGS" />-->
<!-- <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />-->
<!-- <uses-permission android:name="android.permission.READ_LOGS" />-->
<permission android:name="com.mints.fiveworld.permission.JPUSH_MESSAGE" />
<!-- <permission android:name="com.mints.fiveworld.permission.JPUSH_MESSAGE" />-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.mints.fiveworld.permission.JPUSH_MESSAGE" />
<!-- <uses-permission android:name="com.mints.fiveworld.permission.JPUSH_MESSAGE" />-->
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!-- <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />-->
<!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />-->
<!-- <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />-->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<!-- <uses-permission android:name="android.permission.SET_WALLPAPER" />-->
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> <!-- 蘑菇星球 -->
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
......@@ -88,13 +88,13 @@
<meta-data
android:name="UMENG_KEY"
android:value="${UMENG_KEY}" />
<!-- 极光 -->
<meta-data
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" />
<meta-data
android:name="JPUSH_CHANNEL"
android:value="${JPUSH_CHANNEL}" />
<!-- &lt;!&ndash; 极光 &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="JPUSH_APPKEY"-->
<!-- android:value="${JPUSH_APPKEY}" />-->
<!-- <meta-data-->
<!-- android:name="JPUSH_CHANNEL"-->
<!-- android:value="${JPUSH_CHANNEL}" />-->
<!-- talking data -->
<meta-data
android:name="TD_APP_ID"
......@@ -293,28 +293,28 @@
android:enabled="true"
android:exported="false" />
<!-- JPUSH 用户自定义的广播接收器 -->
<receiver
android:name="com.mints.fiveworld.service.JpushReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required 用户注册SDK的intent -->
<action android:name="cn.jpush.android.intent.UNREGISTRATION" />
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required 用户接收SDK消息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent -->
<action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" /> <!-- Optional 用户接受Rich Push Javascript 回调函数的intent -->
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 -->
<category android:name="${applicationId}" />
</intent-filter>
</receiver> <!-- since 3.3.0 接收JPush相关事件 -->
<receiver android:name="com.mints.fiveworld.service.PushMessageReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<!-- <receiver-->
<!-- android:name="com.mints.fiveworld.service.JpushReceiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.intent.REGISTRATION" /> &lt;!&ndash; Required 用户注册SDK的intent &ndash;&gt;-->
<!-- <action android:name="cn.jpush.android.intent.UNREGISTRATION" />-->
<!-- <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> &lt;!&ndash; Required 用户接收SDK消息的intent &ndash;&gt;-->
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> &lt;!&ndash; Required 用户接收SDK通知栏信息的intent &ndash;&gt;-->
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> &lt;!&ndash; Required 用户打开自定义通知栏的intent &ndash;&gt;-->
<!-- <action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" /> &lt;!&ndash; Optional 用户接受Rich Push Javascript 回调函数的intent &ndash;&gt;-->
<!-- <action android:name="cn.jpush.android.intent.CONNECTION" /> &lt;!&ndash; 接收网络变化 连接/断开 since 1.6.3 &ndash;&gt;-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver> &lt;!&ndash; since 3.3.0 接收JPush相关事件 &ndash;&gt;-->
<!-- <receiver android:name="com.mints.fiveworld.service.PushMessageReceiver">-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />-->
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<provider
android:name="androidx.core.content.FileProvider"
......
package com.mints.fiveworld
import android.app.Notification
import android.content.Context
import android.content.Intent
import androidx.core.app.JobIntentService
import cn.jpush.android.api.BasicPushNotificationBuilder
import cn.jpush.android.api.JPushInterface
import com.downloader.PRDownloader
import com.downloader.PRDownloaderConfig
......@@ -40,7 +37,7 @@ class InitAppService : JobIntentService() {
*/
private fun initApplication() {
// 极光推送
initJpush()
// initJpush()
// PR下载附件
initPRDownloader()
......@@ -59,16 +56,16 @@ class InitAppService : JobIntentService() {
/**
* 绑定jpush
*/
private fun initJpush() {
JPushInterface.setDebugMode(BuildConfig.LOG_DEBUG) // 设置开启日志,发布时请关闭日志
JPushInterface.init(this)
val builder = BasicPushNotificationBuilder(applicationContext)
builder.statusBarDrawable = R.drawable.ic_launcher_main
builder.notificationFlags = Notification.FLAG_AUTO_CANCEL //设置为自动消失
builder.notificationDefaults =
Notification.DEFAULT_SOUND or Notification.DEFAULT_VIBRATE or Notification.DEFAULT_LIGHTS // 设置为铃声与震动都要
JPushInterface.setDefaultPushNotificationBuilder(builder)
}
// private fun initJpush() {
// JPushInterface.setDebugMode(BuildConfig.LOG_DEBUG) // 设置开启日志,发布时请关闭日志
// JPushInterface.init(this)
// val builder = BasicPushNotificationBuilder(applicationContext)
// builder.statusBarDrawable = R.drawable.ic_launcher_main
// builder.notificationFlags = Notification.FLAG_AUTO_CANCEL //设置为自动消失
// builder.notificationDefaults =
// Notification.DEFAULT_SOUND or Notification.DEFAULT_VIBRATE or Notification.DEFAULT_LIGHTS // 设置为铃声与震动都要
// JPushInterface.setDefaultPushNotificationBuilder(builder)
// }
override fun onHandleWork(intent: Intent) {
if (isInit) return
......
......@@ -82,7 +82,7 @@ class MainPresenter : BasePresenter<MainView>() {
Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(forwardActivity, HintActivity::class.java)
intent.putExtra(HintActivity.HINT_TEXT, baseResponse.data.msg)
forwardActivity.startActivity(intent)
// forwardActivity.startActivity(intent)
}, 200)
}
}
......
package com.mints.fiveworld.ui.activitys
import android.Manifest
import android.app.Dialog
import android.content.Context
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import androidx.fragment.app.Fragment
import com.mints.fiveworld.R
import com.mints.fiveworld.common.AppConfig
......@@ -22,6 +24,8 @@ import com.mints.fiveworld.mvp.presenters.MainPresenter
import com.mints.fiveworld.mvp.views.MainView
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.fragment.WifiFragment
import com.mints.fiveworld.ui.widgets.dialog.DialogListener
import com.mints.fiveworld.ui.widgets.dialog.DialogUtils
import com.mints.fiveworld.utils.WifiUtils
import com.permissionx.guolindev.PermissionX
......@@ -109,25 +113,51 @@ class MainActivity : BaseActivity(), MainView {
// 第一次授权
if (AppPreferencesManager.get().getBoolean(Constant.IS_ONE_PERMISSIONS, true)) {
AppPreferencesManager.get().put(Constant.IS_ONE_PERMISSIONS, false)
checkPermission()
// checkPermission()
showPermissionDialog()
(threeFragment as WifiFragment).setIsFirstEnter(true)
}
}
fun showPermissionDialog() {
DialogUtils.showDialog(
this, "为了提供更好的服务体验,我们需要像您申请以下权限:" +
"\n 设备信息" +
"\n 位置" +
"\n 存储",
"提示",
"确定",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
this@MainActivity.checkPermission()
}
},
"取消",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
}
}
)
}
/** 检测权限 */
private fun checkPermission() {
val permissionBuilder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
PermissionX.init(this).permissions(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
} else {
PermissionX.init(this).permissions(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
}
permissionBuilder.request { _, _, _ ->
......
package com.mints.fiveworld.utils
import com.tencent.mmkv.MMKV
object MmkvUtils {
var mmkv: MMKV? = null
init {
mmkv = MMKV.defaultMMKV()
}
fun encode(key: String, value: Any?) {
when (value) {
is String -> mmkv?.encode(key, value)
is Float -> mmkv?.encode(key, value)
is Boolean -> mmkv?.encode(key, value)
is Int -> mmkv?.encode(key, value)
is Long -> mmkv?.encode(key, value)
is Double -> mmkv?.encode(key, value)
is ByteArray -> mmkv?.encode(key, value)
is Nothing -> return
}
}
fun decodeInt(key: String): Int? {
return mmkv?.decodeInt(key, 0)
}
fun decodeDouble(key: String): Double? {
return mmkv?.decodeDouble(key, 0.00)
}
fun decodeLong(key: String): Long? {
return mmkv?.decodeLong(key, 0L)
}
fun decodeBoolean(key: String): Boolean? {
return mmkv?.decodeBool(key, false)
}
fun decodeFloat(key: String): Float? {
return mmkv?.decodeFloat(key, 0F)
}
fun decodeByteArray(key: String): ByteArray? {
return mmkv?.decodeBytes(key)
}
fun decodeString(key: String): String? {
return mmkv?.decodeString(key, "")
}
fun removeKey(key: String) {
mmkv?.removeValueForKey(key)
}
fun clearAll() {
mmkv?.clearAll()
}
}
\ No newline at end of file
//package com.mints.fiveworld.utils
//
//import com.tencent.mmkv.MMKV
//
//object MmkvUtils {
//
// var mmkv: MMKV? = null
//
// init {
// mmkv = MMKV.defaultMMKV()
// }
//
// fun encode(key: String, value: Any?) {
// when (value) {
// is String -> mmkv?.encode(key, value)
// is Float -> mmkv?.encode(key, value)
// is Boolean -> mmkv?.encode(key, value)
// is Int -> mmkv?.encode(key, value)
// is Long -> mmkv?.encode(key, value)
// is Double -> mmkv?.encode(key, value)
// is ByteArray -> mmkv?.encode(key, value)
// is Nothing -> return
// }
// }
//
// fun decodeInt(key: String): Int? {
// return mmkv?.decodeInt(key, 0)
// }
//
// fun decodeDouble(key: String): Double? {
// return mmkv?.decodeDouble(key, 0.00)
// }
//
// fun decodeLong(key: String): Long? {
// return mmkv?.decodeLong(key, 0L)
// }
//
// fun decodeBoolean(key: String): Boolean? {
// return mmkv?.decodeBool(key, false)
// }
//
// fun decodeFloat(key: String): Float? {
// return mmkv?.decodeFloat(key, 0F)
// }
//
// fun decodeByteArray(key: String): ByteArray? {
// return mmkv?.decodeBytes(key)
// }
//
// fun decodeString(key: String): String? {
// return mmkv?.decodeString(key, "")
// }
//
// fun removeKey(key: String) {
// mmkv?.removeValueForKey(key)
// }
//
// fun clearAll() {
// mmkv?.clearAll()
// }
//
//}
\ 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