Commit 084a60cb by 范玉宾

fix hw foreground anr

parent 5ac59c8a
......@@ -16,7 +16,7 @@ ext {
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.64",
"m-muse" : "0.0.28.70",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
......@@ -103,7 +103,7 @@ ext {
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.8",
"m-muse" : "0.0.28.64",
"m-muse" : "0.0.28.70",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
//-------------- 业务模块 API 层 --------------
......
......@@ -3,6 +3,7 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application>
<activity
......
......@@ -80,17 +80,6 @@ class MeditationWindowService : Service() {
override fun onCreate() {
super.onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channel = NotificationChannel("壹点灵","play",NotificationManager.IMPORTANCE_LOW)
manager.createNotificationChannel(channel)
val notification = NotificationCompat.Builder(this,"壹点灵").build()
startForeground(1,notification)
}
}
EventBus.getDefault().register(this)
}
......@@ -322,6 +311,12 @@ class MeditationWindowService : Service() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channel = NotificationChannel("壹点灵","play",NotificationManager.IMPORTANCE_HIGH)
manager.createNotificationChannel(channel)
val notification = NotificationCompat.Builder(this,"壹点灵").build()
startForeground(1,notification)
startForegroundService(intent)
}else{
startService(intent)
......
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