百度云推送-----10101错误

前言

最近在弄百度云推送Android端,按照官方的文档 配置,可是还是报错errorCode 10101
看官方解析10101 是因为配置或者集成错误。
于是我在一遍一遍的复制,结果还是一样10101

贴一下报错前的AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
    <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
    <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            intent-filter>
        activity>

        
        
        <receiver android:name="com.baidu.android.pushservice.PushServiceReceiver"
            android:process=":bdservice_v1" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name="com.baidu.android.pushservice.action.notification.SHOW" />
                <action android:name="com.baidu.android.pushservice.action.media.CLICK" />
                
                <action android:name="android.intent.action.MEDIA_MOUNTED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
                <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
            intent-filter>
        receiver>
        
        <receiver android:name="com.baidu.android.pushservice.RegistrationReceiver"
            android:process=":bdservice_v1" >
            <intent-filter>
                <action android:name="com.baidu.android.pushservice.action.METHOD" />
                <action android:name="com.baidu.android.pushservice.action.BIND_SYNC" />
            intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REMOVED" />
                <data android:scheme="package" />
            intent-filter>
        receiver>
        <service android:name="com.baidu.android.pushservice.PushService" android:exported="true"
            android:process=":bdservice_v1" >
            <intent-filter >
                <action android:name="com.baidu.android.pushservice.action.PUSH_SERVICE" />
            intent-filter>
        service>
        
        <service android:name="com.baidu.android.pushservice.CommandService"
            android:exported="true" />
        

        
        <receiver android:name=".PushReceiver">
            <intent-filter>
                
                <action android:name="com.baidu.android.pushservice.action.MESSAGE" />
                
                <action android:name="com.baidu.android.pushservice.action.RECEIVE" />
                
                <action android:name="com.baidu.android.pushservice.action.notification.CLICK" />
            intent-filter>
        receiver>
    application>

添加后正常

 
       
    <uses-permission android:name="baidu.push.permission.WRITE_PUSHINFOPROVIDER.com.xxx.xxx" />
<permission
  android:name="baidu.push.permission.WRITE_PUSHINFOPROVIDER.com.xxx.xxx"
        android:protectionLevel="normal">
    permission>


  
        <provider
            android:name="com.baidu.android.pushservice.PushInfoProvider"
            android:authorities="com.xxx.xxx.bdpush"
            android:writePermission="baidu.push.permission.WRITE_PUSHINFOPROVIDER.com.xxx.xxx"
            android:exported="true" />

errorCode =0 成功获取channelID
我用的是 Android5.1系统的测试机,添加的这两段都是为Android N 声明的。具体原因也不清楚。

你可能感兴趣的:(android)