Commit acf01c9e by 刘鹏

Merge branch 'feat/lp/lp_4408_mr_release' into 'd/v4.4.08'

Feat/lp/lp 4408 mr release

See merge request app_android_lib/YDL-Component!332
parents a00b71db b92178ac
......@@ -17,5 +17,7 @@
android:launchMode="singleTask"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="portrait" />
<service android:name=".AudioService"/>
</application>
</manifest>
package com.ydl.audioim
import android.app.*
import android.content.Context
import android.content.Intent
import android.os.Build
class AudioService : Service() {
override fun onCreate() {
val createNotification = createNotification(this)
startForeground(12001, createNotification)
}
override fun onBind(intent: Intent?) = null
private fun createNotification(context: Context): Notification = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
// 创建消息渠道
val channel =
NotificationChannel("EasyFloat", "系统悬浮窗", NotificationManager.IMPORTANCE_MIN)
val manager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
Notification.Builder(context, "EasyFloat")
.setCategory(Notification.CATEGORY_SERVICE)
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ->
Notification.Builder(context)
.setCategory(Notification.CATEGORY_SERVICE)
.setPriority(Notification.PRIORITY_MIN)
else -> Notification.Builder(context)
}
// .setSmallIcon(R.drawable.audioim_audio_home_img_answer)
// .setContentText("正在通话中")
// .setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), 0))
.setAutoCancel(true)
.setOngoing(true)
.build()
}
\ 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