Commit cf5b475c authored by wanglei's avatar wanglei

...通知intent

parent 2ed3614b
......@@ -3,6 +3,7 @@ package com.base.appzxhy.utils
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.Settings
object IntentUtils {
......@@ -14,9 +15,16 @@ object IntentUtils {
return intent
}
fun intentLocationSetting(): Intent {
val intent: Intent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
fun intentNotificationSettings(context: Context): Intent {
val intent = Intent()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
} else {
intent.action = "android.settings.APP_NOTIFICATION_SETTINGS"
intent.putExtra("app_package", context.packageName)
}
return intent
}
}
\ 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