refactor(servicing): 优化推送消息处理并更新版本号- 更新项目版本号至 1.0.1.9.9.33
- 修改 MainActivity 中的 taskCode 以反映新的任务编号 - 注释掉 PushMessageActivity 中的 setupPushMessageReceiver 方法调用 - 调整 ServiceManager 中的推送消息接收器注册逻辑 - 修改 PUSH_MESSAGE意图的处理方式,增加对主进程的判断
This commit is contained in:
@ -27,7 +27,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clickable {
|
.clickable {
|
||||||
val uri =
|
val uri =
|
||||||
"zd.assist://app?taskCode=ZD250429100095&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
"zd.assist://app?taskCode=ZD250429100116&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
||||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ publishing {
|
|||||||
release(MavenPublication) {
|
release(MavenPublication) {
|
||||||
groupId = 'io.github.szl9'
|
groupId = 'io.github.szl9'
|
||||||
artifactId = 'zd_servicing'
|
artifactId = 'zd_servicing'
|
||||||
version = "1.0.1.9.9.31"
|
version = "1.0.1.9.9.33"
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
packaging = "aar"
|
packaging = "aar"
|
||||||
|
@ -16,7 +16,7 @@ open class PushMessageActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState : Bundle?) {
|
override fun onCreate(savedInstanceState : Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setupPushMessageReceiver()
|
// setupPushMessageReceiver()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupPushMessageReceiver() { // 注册推送消息接收器
|
private fun setupPushMessageReceiver() { // 注册推送消息接收器
|
||||||
|
@ -44,9 +44,7 @@ object ServiceManager {
|
|||||||
LogUtil.print("ServiceManager", "Initializing ServiceManager")
|
LogUtil.print("ServiceManager", "Initializing ServiceManager")
|
||||||
jpushRegister(context)
|
jpushRegister(context)
|
||||||
MyMqttClient.initialize(deviceId = DeviceUtil.getAndroidId(context))
|
MyMqttClient.initialize(deviceId = DeviceUtil.getAndroidId(context))
|
||||||
if (! GlobalData.isMaster) {
|
setupPushMessageReceiver(context)
|
||||||
setupPushMessageReceiver(context)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupPushMessageReceiver(context : Context) { // 注册推送消息接收器
|
private fun setupPushMessageReceiver(context : Context) { // 注册推送消息接收器
|
||||||
@ -82,7 +80,9 @@ object ServiceManager {
|
|||||||
private fun sendMessageToMainProcess(context : Context,
|
private fun sendMessageToMainProcess(context : Context,
|
||||||
type : String,
|
type : String,
|
||||||
message : String) { // 使用广播将消息发送到主进程
|
message : String) { // 使用广播将消息发送到主进程
|
||||||
val intent = Intent("com.za.rescue.dealer.PUSH_MESSAGE")
|
val intent = Intent("com.za.rescue.dealer.PUSH_MESSAGE".takeIf { GlobalData.isMaster }
|
||||||
|
?: ZdPushServiceReceive.RECEIVE_ACTION)
|
||||||
|
intent.setPackage(context.packageName)
|
||||||
intent.putExtra("type", type)
|
intent.putExtra("type", type)
|
||||||
intent.putExtra("message", message)
|
intent.putExtra("message", message)
|
||||||
context.sendBroadcast(intent)
|
context.sendBroadcast(intent)
|
||||||
|
Reference in New Issue
Block a user