|
@@ -6,11 +6,11 @@ import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.os.Build
|
|
|
import android.os.IBinder
|
|
|
-import android.util.Log
|
|
|
import androidx.annotation.Nullable
|
|
|
import com.common.lib_base.utils.log.AppLogUtils
|
|
|
import com.hh.hhomc.R
|
|
|
import com.hh.hhomc.WxAidlInterface
|
|
|
+import com.hh.hhomc.utils.DeviceUtils
|
|
|
|
|
|
|
|
|
class RemoteService: Service() {
|
|
@@ -21,12 +21,12 @@ class RemoteService: Service() {
|
|
|
|
|
|
class MyBinder : WxAidlInterface.Stub(){
|
|
|
override fun basicTypes(
|
|
|
- anInt: Int,
|
|
|
- aLong: Long,
|
|
|
- aBoolean: Boolean,
|
|
|
- aFloat: Float,
|
|
|
- aDouble: Double,
|
|
|
- aString: String?
|
|
|
+ anInt: Int,
|
|
|
+ aLong: Long,
|
|
|
+ aBoolean: Boolean,
|
|
|
+ aFloat: Float,
|
|
|
+ aDouble: Double,
|
|
|
+ aString: String?
|
|
|
) {
|
|
|
}
|
|
|
}
|
|
@@ -45,7 +45,7 @@ class RemoteService: Service() {
|
|
|
var channel = NotificationChannel("101", "test", NotificationManager.IMPORTANCE_HIGH);
|
|
|
notificationManager.createNotificationChannel(channel);
|
|
|
}
|
|
|
- startForeground(1,getNotification());
|
|
|
+ startForeground(1, getNotification());
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
|
|
startService(Intent(this, LocalService.InnnerService::class.java))
|
|
|
}
|
|
@@ -55,7 +55,7 @@ class RemoteService: Service() {
|
|
|
var builder = Notification.Builder(this)
|
|
|
.setSmallIcon(R.mipmap.ic_launcher)
|
|
|
.setContentTitle("hhomc服务")
|
|
|
- .setContentText("我正在运行");
|
|
|
+ .setContentText("我正在运行——SN:" + DeviceUtils.getDeviceSN());
|
|
|
//设置Notification的ChannelID,否则不能正常显示
|
|
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
builder.setChannelId("101");
|
|
@@ -81,8 +81,8 @@ class RemoteService: Service() {
|
|
|
//连接中断后回调
|
|
|
startService(Intent(this@RemoteService, LocalService::class.java))
|
|
|
bindService(
|
|
|
- Intent(this@RemoteService, LocalService::class.java), serviceConnection,
|
|
|
- Context.BIND_AUTO_CREATE
|
|
|
+ Intent(this@RemoteService, LocalService::class.java), serviceConnection,
|
|
|
+ Context.BIND_AUTO_CREATE
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -100,7 +100,7 @@ class RemoteService: Service() {
|
|
|
var channel = NotificationChannel("101", "test", NotificationManager.IMPORTANCE_HIGH);
|
|
|
notificationManager.createNotificationChannel(channel);
|
|
|
}
|
|
|
- startForeground(1,getNotification())
|
|
|
+ startForeground(1, getNotification())
|
|
|
stopSelf()
|
|
|
}
|
|
|
|
|
@@ -108,7 +108,7 @@ class RemoteService: Service() {
|
|
|
var builder = Notification.Builder(this)
|
|
|
.setSmallIcon(R.mipmap.ic_launcher)
|
|
|
.setContentTitle("hhomc服务")
|
|
|
- .setContentText("我正在运行");
|
|
|
+ .setContentText("我正在运行——SN:" + DeviceUtils.getDeviceSN());
|
|
|
//设置Notification的ChannelID,否则不能正常显示
|
|
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
builder.setChannelId("101");
|