Commit c28d0699 by 刘鹏

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

feat: 去掉声网自定义service

See merge request app_android_lib/YDL-Component!333
parents acf01c9e d0622f49
...@@ -33,7 +33,6 @@ import com.ydl.audioim.http.command.ConnectExceptionCommand ...@@ -33,7 +33,6 @@ import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.PayLoad import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.listener.IntentConstants import com.ydl.audioim.listener.IntentConstants
import com.ydl.audioim.notification.FloatService
import com.ydl.audioim.player.AudioPlayer import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.router.AudioImIn import com.ydl.audioim.router.AudioImIn
...@@ -234,7 +233,6 @@ class AudioHomeActivity : ...@@ -234,7 +233,6 @@ class AudioHomeActivity :
private var canChangeRoute: Boolean = false private var canChangeRoute: Boolean = false
private var hasHandleRefused = false private var hasHandleRefused = false
private var mServiceIntent: Intent? = null
private val notificationCallback = object : IMRegisterObserverCustomNotificationCallBack { private val notificationCallback = object : IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(fromUid: String, toUid: String, content: String) { override fun onObserverCustomNotification(fromUid: String, toUid: String, content: String) {
if (fromUid == listenerUid) { if (fromUid == listenerUid) {
...@@ -522,12 +520,6 @@ class AudioHomeActivity : ...@@ -522,12 +520,6 @@ class AudioHomeActivity :
override fun initDataAndEvent() { override fun initDataAndEvent() {
//状态栏颜色 //状态栏颜色
setWindowStatusBarColor() setWindowStatusBarColor()
mServiceIntent = Intent(this@AudioHomeActivity, FloatService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(mServiceIntent)
} else {
startService(mServiceIntent)
}
//初始化传感器 //初始化传感器
initSensorManager() initSensorManager()
//页面传递数据初始化 //页面传递数据初始化
...@@ -1607,7 +1599,6 @@ class AudioHomeActivity : ...@@ -1607,7 +1599,6 @@ class AudioHomeActivity :
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
stopService(mServiceIntent)
findRouteService(IImService::class.java).unregisterObserveCustomNotification(notificationCallback) findRouteService(IImService::class.java).unregisterObserveCustomNotification(notificationCallback)
uploadLog() uploadLog()
phoneHandler?.removeCallbacksAndMessages(null) phoneHandler?.removeCallbacksAndMessages(null)
......
package com.ydl.audioim.notification
import android.app.*
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.ydl.audioim.R
class FloatService : Service() {
var notificationManager: NotificationManager? = null;
var notificationId = "audio_av";
var notificationName = "正在通话中";
override fun onBind(intent: Intent?): IBinder? {
return null
}
override fun onCreate() {
super.onCreate()
notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
//创建NotificationChannel
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var channel = NotificationChannel(
notificationId,
notificationName,
NotificationManager.IMPORTANCE_HIGH
);
//不震动
channel.enableVibration(false);
//静音
channel.setSound(null, null);
notificationManager?.createNotificationChannel(channel);
}
//创建服务后,五秒内调用该方法
startForeground(1, getNotification());
}
/**
* 获取通知(Android8.0后需要)
* @return
*/
fun getNotification(): Notification {
var builder = Notification.Builder(this)
.setSmallIcon(R.drawable.dialog_list_bg)
.setContentTitle("壹点灵")
.setContentIntent(getIntent())
.setContentText("正在通话中");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(notificationId);
}
return builder.build();
}
/**
* 点击后,直接打开app(之前的页面),不跳转特定activity
* @return
*/
fun getIntent(): PendingIntent {
var msgIntent =
applicationContext.packageManager.getLaunchIntentForPackage(packageName);//获取启动Activity
var pendingIntent = PendingIntent.getActivity(
applicationContext,
1,
msgIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
return pendingIntent;
}
}
\ No newline at end of file
...@@ -11,7 +11,6 @@ import android.hardware.SensorEvent ...@@ -11,7 +11,6 @@ import android.hardware.SensorEvent
import android.hardware.SensorEventListener import android.hardware.SensorEventListener
import android.hardware.SensorManager import android.hardware.SensorManager
import android.net.Uri import android.net.Uri
import android.os.Build
import android.os.PowerManager import android.os.PowerManager
import android.provider.Settings import android.provider.Settings
import android.text.TextUtils import android.text.TextUtils
...@@ -27,7 +26,6 @@ import com.ydl.audioim.R ...@@ -27,7 +26,6 @@ import com.ydl.audioim.R
import com.ydl.audioim.YDLavManager import com.ydl.audioim.YDLavManager
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.PayLoad import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.notification.FloatService
import com.ydl.audioim.player.AudioPlayer import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.utils.AudioLogUtils import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.audioim.utils.DateUtils import com.ydl.audioim.utils.DateUtils
...@@ -120,7 +118,6 @@ class ConsultantAudioHomeActivity : ...@@ -120,7 +118,6 @@ class ConsultantAudioHomeActivity :
* 是否连接成功 * 是否连接成功
*/ */
private var isConnectSuccess: Boolean = false private var isConnectSuccess: Boolean = false
private var mServiceIntent: Intent? = null
companion object { companion object {
const val PARAM: String = "param" const val PARAM: String = "param"
...@@ -501,12 +498,6 @@ class ConsultantAudioHomeActivity : ...@@ -501,12 +498,6 @@ class ConsultantAudioHomeActivity :
override fun initDataAndEvent() { override fun initDataAndEvent() {
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
callEventSave("30", "进入接听界面") callEventSave("30", "进入接听界面")
mServiceIntent = Intent(this@ConsultantAudioHomeActivity, FloatService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(mServiceIntent)
} else {
startService(mServiceIntent)
}
//状态栏颜色 //状态栏颜色
setWindowStatusBarColor() setWindowStatusBarColor()
//点亮屏幕 并解锁 //点亮屏幕 并解锁
...@@ -1123,7 +1114,6 @@ class ConsultantAudioHomeActivity : ...@@ -1123,7 +1114,6 @@ class ConsultantAudioHomeActivity :
} }
override fun onDestroy() { override fun onDestroy() {
stopService(mServiceIntent)
LogUtil.e("http-------------onDestory") LogUtil.e("http-------------onDestory")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA, "咨询用户端:onDestroy channelId:${mAudioMessageBean?.channelId}") AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA, "咨询用户端:onDestroy channelId:${mAudioMessageBean?.channelId}")
......
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