开发者社区> 问答> 正文

EMAS我的应用,在使用小米注册的时候总是不成功,我试着把小米的账户放到了demo中,是可以的,但?

EMAS我的应用,在使用小米注册的时候总是不成功,我试着把小米的账户放到了demo中,是可以的,但是放到我项目中,使用flutter调用原生然后进行小米注册就不成功了,也不报错,这个还能如何排查呢?能够调用输出日志[MPS:MiPushRegister] register begin我是通过flutter调用原生Android进行的,if(call.method.equals("registerAliyun")){ val account = call.argument("account") val pushService: CloudPushService = PushServiceFactory.getCloudPushService() pushService.setLogLevel(CloudPushService.LOG_DEBUG) //仅适用于Debug包,正式包不需要此行

            //获取手机品牌
            val deviceId = pushService.deviceId
            Log.d(TAG, "bind account deviceId: $deviceId")

            pushService.register(applicationContext, object : CommonCallback {
                override fun onSuccess(response: String?) {
                    Log.d(TAG, "init cloudchannel success")

                    val brand = Build.MANUFACTURER

                    when{
                            "xiaomi".equals(brand, true) || "redmi".equals(brand, true) ->{
                                MiPushRegister.register(applicationContext, "", "")
                            }
                        }

                    pushService.bindAccount(account, object: CommonCallback{
                        override fun onSuccess(response: String?) {
                            Log.d(TAG, "bind account success! response: $response")
                            result.success(true)
                        }

                        override fun onFailed(errorCode: String?, errorMsg: String?) {
                            Log.d(TAG, "bind account failed. errorCode: $errorCode, errorMsg: $errorMsg")
                            result.error(errorCode, errorMsg, null)
                        }
                    })
                }

                override fun onFailed(errorCode: String, errorMessage: String) {
                    Log.d(
                        TAG,
                        "init cloudchannel failed -- errorcode:$errorCode -- errorMessage:$errorMessage"
                    )
                    result.error(errorCode, errorMessage, null)
                }
            })张京伟@6月9日 13:42    /** 阿里推送  */
implementation 'com.aliyun.ams:alicloud-android-push:3.8.6'
//辅助通道基础依赖
implementation 'com.aliyun.ams:alicloud-android-third-push:3.8.6'
//华为依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-huawei:3.8.6'
//小米国内通道依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.6.1'
//OPPO依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-oppo:3.8.6'
//vivo依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-vivo:3.8.6'
//魅族依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-meizu:3.8.6'
//荣耀依赖
implementation 'com.aliyun.ams:alicloud-android-third-push-honor:3.8.6',引入的包是这些,我在注册小米的地方注册vivo是可以成功的,正确的,比较了好几遍,而且我这里的代码,放到demo中是正常的

展开
收起
cuicuicuic 2023-06-13 18:51:18 49 0
1 条回答
写回答
取消 提交回答
  • 你调用的代码发下,秘钥填写正确了吗?,此回答整理自钉群“【移动推送】技术支持3群-应用研发平台EMAS”

    2023-06-13 19:12:31
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
基于阿里巴巴以及合作伙伴的最佳实践,围绕大前端、云原生领域的相关技术热点(小程序、Serverless、应用中间件、低代码、DevOps)展开行业探讨,与开发者一起探寻云原生时代应用研发的新范式。
相关文档: 移动研发平台
问答排行榜
最热
最新

相关电子书

更多
五天玩转EMAS Serverless 立即下载
EMAS平台全景介绍 立即下载
低代码开发师(初级)实战教程 立即下载