5***@qq.com
5***@qq.com
  • 发布:2024-03-07 16:46
  • 更新:2024-03-13 10:49
  • 阅读:650

【报Bug】unipush1.0荣耀设备获取不到deviceToken

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows11

HBuilderX类型: 正式

HBuilderX版本号: 3.99

手机系统: Android

手机系统版本号: Android 13

手机厂商: 荣耀

手机机型: HONOR REA-ANE00

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

项目集成unipush。
使用自有证书,云打包,勾选渠道:华为

预期结果:

能获取到deviceToken,能收到离线推送消息

实际结果:

没有获取到deviceToken,无法下发离线消息到荣耀

bug描述:

集成了unipush1.0,勾选了荣耀推送厂商配置,荣耀创建企业认证开发者,创建应用,开通推送服务,DCloud配置厂商荣耀信息。云端打正式包,进入应用后,获取到cid,在线推送测试没问题,离线消息收不到,用DCloud消息推送工具排查,发现设备没有deviceToken,与个推技术支持沟通,配置信息未发现问题。按照自检命令adb logcat | grep "Assist_" 发现也没有token返回

2024-03-07 16:46 负责人:无 分享
已邀请:
DCloud_Android_THB

DCloud_Android_THB

没有荣耀sdk的情况是你用的cli打包,你的cli版本是3.3.0 , 荣耀sdk支持是3.99

5***@qq.com

5***@qq.com (作者)

自己重新创建了1个Android应用获取荣耀deviceToken能够成功,unipush集成荣耀配置后,获取不到token

9***@qq.com

9***@qq.com

大概率集成荣耀推送时配置没对应上

  • 5***@qq.com (作者)

    厂商的配置相对简单,配置应该没有什么问题的,我下面了下配置截图

    2024-03-08 15:46

5***@qq.com

5***@qq.com (作者)

荣耀厂商配置

5***@qq.com

5***@qq.com (作者)

我自己新建了一个空的uniapp应用,与原来的项目使用同样的uniappID、android应用包名、签名、证书,荣耀离线厂商配置,分别打包,我的自建应用能拿到荣耀deviceToken,而原来的项目拿不到。把打出来的包做了下比对,发现几个地方有区别

5***@qq.com

5***@qq.com (作者)

自建应用的配置:

{  
    "name" : "test-th-app",  
    "appid" : "__UNI__3D5F3D6",  
    "description" : "trunk",  
    "versionName" : "1.0.0",  
    "versionCode" : "100",  
    "transformPx" : false,  
    /* 5+App特有相关 */  
    "app-plus" : {  
        "privacy" : {  
            "prompt" : "template",  
            "template" : {  
                "title" : "隐私政策",  
                "message" : "qqq",  
                "buttonAccept" : "已阅读隐私政策并同意", //继续下一步  
                "buttonRefuse" : "不同意" //退出下载  
            }  
        },  
        "usingComponents" : true,  
        "safearea" : {  
            "background" : "#fff",  
            "bottom" : {  
                "offset" : "auto"  
            }  
        },  
        "compatible" : {  
            "ignoreVersion" : true  
        },  
        "nvueStyleCompiler" : "uni-app",  
        "compilerVersion" : 2,  
        "splashscreen" : {  
            "alwaysShowBeforeRender" : true,  
            "waiting" : true,  
            "autoclose" : true,  
            "delay" : 0  
        },  
        /* 模块配置 */  
        "modules" : {  
            "Camera" : {},  
            "Push" : {},  
            "Share" : {},  
            "VideoPlayer" : {}  
        },  
        /* 应用发布信息 */  
        "distribute" : {  
            /* android打包配置 */  
            "android" : {  
                "permissions" : [  
                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",  
                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",  
                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",  
                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",  
                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",  
                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",  
                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",  
                    "<uses-feature android:name=\"android.hardware.camera\"/>",  
                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"  
                ],  
                "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],  
                "minSdkVersion" : 23,  
                "targetSdkVersion" : 28  
            },  
            /* ios打包配置 */  
            "ios" : {  
                "dSYMs" : false  
            },  
            /* SDK配置 */  
            "sdkConfigs" : {  
                "push" : {  
                    "unipush" : {  
                        "icons" : {  
                            "small" : {  
                                "ldpi" : "unpackage/res/small/ldpi.png",  
                                "mdpi" : "unpackage/res/small/mdpi.png",  
                                "hdpi" : "unpackage/res/small/hdpi.png",  
                                "xhdpi" : "unpackage/res/small/xhdpi.png",  
                                "xxhdpi" : "unpackage/res/small/xxhdpi.png"  
                            }  
                        }  
                    }  
                },  
                "share" : {},  
                "ad" : {}  
            },  
            "splashscreen" : {  
                "useOriginalMsgbox" : true  
            },  
            "icons" : {  
                "android" : {  
                    "hdpi" : "unpackage/res/icons/72x72.png",  
                    "xhdpi" : "unpackage/res/icons/96x96.png",  
                    "xxhdpi" : "unpackage/res/icons/144x144.png",  
                    "xxxhdpi" : "unpackage/res/icons/192x192.png"  
                },  
                "ios" : {  
                    "appstore" : "unpackage/res/icons/1024x1024.png",  
                    "iphone" : {  
                        "app@2x" : "unpackage/res/icons/120x120.png",  
                        "app@3x" : "unpackage/res/icons/180x180.png",  
                        "spotlight@2x" : "unpackage/res/icons/80x80.png",  
                        "spotlight@3x" : "unpackage/res/icons/120x120.png",  
                        "settings@2x" : "unpackage/res/icons/58x58.png",  
                        "settings@3x" : "unpackage/res/icons/87x87.png",  
                        "notification@2x" : "unpackage/res/icons/40x40.png",  
                        "notification@3x" : "unpackage/res/icons/60x60.png"  
                    },  
                    "ipad" : {  
                        "app" : "unpackage/res/icons/76x76.png",  
                        "app@2x" : "unpackage/res/icons/152x152.png",  
                        "proapp@2x" : "unpackage/res/icons/167x167.png",  
                        "spotlight" : "unpackage/res/icons/40x40.png",  
                        "spotlight@2x" : "unpackage/res/icons/80x80.png",  
                        "settings" : "unpackage/res/icons/29x29.png",  
                        "settings@2x" : "unpackage/res/icons/58x58.png",  
                        "notification" : "unpackage/res/icons/20x20.png",  
                        "notification@2x" : "unpackage/res/icons/20x20.png"  
                    }  
                }  
            }  
        },  
        "nvueLaunchMode" : ""  
    },  
    /* 快应用特有相关 */  
    "quickapp" : {},  
    /* 小程序特有相关 */  
    "mp-weixin" : {  
        "appid" : "",  
        "setting" : {  
            "urlCheck" : true  
        },  
        "usingComponents" : true  
    },  
    "mp-alipay" : {  
        "usingComponents" : true  
    },  
    "mp-baidu" : {  
        "usingComponents" : true  
    },  
    "mp-toutiao" : {  
        "usingComponents" : true  
    },  
    "uniStatistics" : {  
        "enable" : false  
    },  
    "vueVersion" : "2",  
    "h5" : {  
        "devServer" : {  
            "port" : 8080  
        }  
    }  
}  
5***@qq.com

5***@qq.com (作者)

原有项目配置:

{  
    "name" : "test-th-app",  
    "appid" : "__UNI__3D5F3D6",  
    "description" : "trunk",  
    "versionName" : "1.0.0",  
    "versionCode" : "100",  
    "transformPx" : false,  
    "app-plus" : {  
        "privacy" : {  
            "prompt" : "template",  
            "template" : {  
                "title" : "隐私政策",  
                "message" : "qqq",  
                "buttonAccept" : "已阅读隐私政策并同意", //继续下一步  
                "buttonRefuse" : "不同意" //退出下载  
            }  
        },  
        "modules" : {  
            "VideoPlayer" : {},  
            "Push" : {},  
            "Share" : {},  
            "Camera" : {}  
        },  
        "optimization" : {  
            "subPackages" : true  
        },  
        "distribute" : {  
            "android" : {  
                "permissions" : [  
                    "<uses-feature android:name=\"android.hardware.camera\"/>",  
                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",  
                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",  
                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",  
                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",  
                    "<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>",  
                    "<uses-permission android:name=\"android.permission.INTERNET\"/>",  
                    "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",  
                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",  
                    "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",  
                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",  
                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",  
                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",  
                    "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",  
                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",  
                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",  
                    "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",  
                    "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",  
                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"  
                ],  
                "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],  
                "minSdkVersion" : 23,  
                "targetSdkVersion" : 28  
            },  
            "ios" : {  
                "dSYMs" : false  
            },  
            /* ios打包配置 */  
            "sdkConfigs" : {  
                "share" : {},  
                "push" : {  
                    "unipush" : {  
                        "icons" : {  
                            // 推送图片配置  
                            "push" : {  
                                // push图标,规格与应用图片一致,不配置则默认使用push图标  
                                "ldpi" : "unpackage/res/push/ldpi.png",  
                                "mdpi" : "unpackage/res/push/mdpi.png",  
                                "hdpi" : "unpackage/res/push/hdpi.png",  
                                "xhdpi" : "unpackage/res/push/xhdpi.png",  
                                "xxhdpi" : "unpackage/res/push/xxhdpi.png",  
                                "xxxhdpi" : "unpackage/res/push/xxxhdpi.png"  
                            },  
                            "small" : {  
                                //  小图标,png格式图片,仅使用alpha图层  
                                "ldpi" : "unpackage/res/small/ldpi.png",  
                                "mdpi" : "unpackage/res/small/mdpi.png",  
                                "hdpi" : "unpackage/res/small/hdpi.png",  
                                "xhdpi" : "unpackage/res/small/xhdpi.png",  
                                "xxhdpi" : "unpackage/res/small/xxhdpi.png"  
                            },  
                            "description" : "推送图标"  
                        }  
                    }  
                },  
                "ad" : {},  
                "payment" : {},  
                "maps" : {}  
            },  
            "splashscreen" : {  
                "androidStyle" : "common"  
            },  
            "icons" : {  
                "android" : {  
                    "hdpi" : "unpackage/res/icons/72x72.png",  
                    "xhdpi" : "unpackage/res/icons/96x96.png",  
                    "xxhdpi" : "unpackage/res/icons/144x144.png",  
                    "xxxhdpi" : "unpackage/res/icons/192x192.png"  
                },  
                "ios" : {  
                    "appstore" : "unpackage/res/icons/1024x1024.png",  
                    "ipad" : {  
                        "app" : "unpackage/res/icons/76x76.png",  
                        "app@2x" : "unpackage/res/icons/152x152.png",  
                        "notification" : "unpackage/res/icons/20x20.png",  
                        "notification@2x" : "unpackage/res/icons/40x40.png",  
                        "proapp@2x" : "unpackage/res/icons/167x167.png",  
                        "settings" : "unpackage/res/icons/29x29.png",  
                        "settings@2x" : "unpackage/res/icons/58x58.png",  
                        "spotlight" : "unpackage/res/icons/40x40.png",  
                        "spotlight@2x" : "unpackage/res/icons/80x80.png"  
                    },  
                    "iphone" : {  
                        "app@2x" : "unpackage/res/icons/120x120.png",  
                        "app@3x" : "unpackage/res/icons/180x180.png",  
                        "notification@2x" : "unpackage/res/icons/40x40.png",  
                        "notification@3x" : "unpackage/res/icons/60x60.png",  
                        "settings@2x" : "unpackage/res/icons/58x58.png",  
                        "settings@3x" : "unpackage/res/icons/87x87.png",  
                        "spotlight@2x" : "unpackage/res/icons/80x80.png",  
                        "spotlight@3x" : "unpackage/res/icons/120x120.png"  
                    }  
                }  
            }  
        },  
        /* SDK配置 */  
        "usingComponents" : true,  
        "safearea" : {  
            "background" : "#fff",  
            "bottom" : {  
                "offset" : "auto"  
            }  
        },  
        "compatible" : {  
            "ignoreVersion" : true  
        },  
        "nvueLaunchMode" : "",  
        "nativePlugins" : {}  
    },  
    "quickapp" : {},  
    /* 快应用特有相关 */  
    "mp-weixin" : {  
        /* 小程序特有相关 */  
        "usingComponents" : true,  
        "appid" : "",  
        "setting" : {  
            "urlCheck" : true  
        }  
    },  
    "mp-alipay" : {  
        "usingComponents" : true  
    },  
    "mp-baidu" : {  
        "usingComponents" : true  
    },  
    "mp-toutiao" : {  
        "usingComponents" : true  
    },  
    "mp-qq" : {  
        "usingComponents" : true  
    },  
    "h5" : {  
        "devServer" : {  
            "port" : 8080  
        }  
    }  
}  
5***@qq.com

5***@qq.com (作者)

反编译了下两个apk,查看了下dex,发现自建应用把荣耀离线pushSDK打包集成进去了,原项目打包没有打进去,打包配置没发现什么区别,所以有点不理解为什么会出现不同结果

要回复问题请先登录注册