无法接收推送消息

时间:2016-06-15 05:25:27

标签: android google-cloud-messaging

当我推送任何消息时,我将com.google.android.c2dm.intent.REGISTRATION置于额外内容中,而不是将com.google.android.c2dm.intent.RECEIVE作为操作。我正在使用Azure Mobile Engagement SDK。它适用于Android 4.2及更高版本的设备,但在以前的设备中遇到了这个问题。下面是我的Manifest文件,用于参考。我的包名是“com.my.package”

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

         

   

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.my.package.permission.C2D_MESSAGE" />
<permission android:name="com.my.package.permission.C2D_MESSAGE" android:protectionLevel="signature" />

<application
    android:name="com.my.package.MyApp"
    android:allowBackup="true"
    android:clearTaskOnLaunch="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name=".activity.SplashActivity"
        android:configChanges="locale"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="android.app.default_searchable"
        android:value="com.my.package.activity.SearchableActivity" />

    <activity
        android:name=".activity.SearchableActivity"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
    </activity>

    <activity
        android:name=".activity.SearchableMoreActivity"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable" />
    </activity>

    <activity
        android:name=".activity.HomeActivity"
        android:configChanges="locale"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="com.my.package.OrangeApp.activity.HOMEACTIVITY" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".activity.SettingsActivity"
        android:configChanges="locale"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">

    </activity>

    <activity
        android:name=".activity.ContentDetailsActivity"
        android:configChanges="locale"
        android:launchMode="standard"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustPan">
    </activity>

    <activity
        android:name=".activity.EventContentActivity"
        android:configChanges="locale"
        android:launchMode="standard"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.MyAccountActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.InfoActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.ShareActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.HelpActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.ArtistItemDetailsActivity"
        android:configChanges="locale"
        android:launchMode="standard"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

    <activity
        android:name=".activity.MusicEventActivity"
        android:configChanges="locale"
        android:launchMode="standard"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

   <service
        android:name="com.microsoft.azure.engagement.service.EngagementService"
        android:exported="false"
        android:label="OrangeService"
        android:process=":Engagement" />

   <activity android:name="com.my.package.engagementActivity.EngagementTextAnnouncementActivity" android:theme="@android:style/Theme.Light">
         <intent-filter>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
             <category android:name="android.intent.category.DEFAULT" />
             <data android:mimeType="text/plain" />
         </intent-filter>
     </activity>
     <activity android:name="com.my.package.engagementActivity.EngagementWebAnnouncementActivity" android:theme="@android:style/Theme.Light">
         <intent-filter>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
             <category android:name="android.intent.category.DEFAULT" />
             <data android:mimeType="text/html" />
         </intent-filter>
     </activity>
     <activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementPollActivity" android:theme="@android:style/Theme.Light">
         <intent-filter>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.POLL"/>
             <category android:name="android.intent.category.DEFAULT" />
         </intent-filter>
     </activity>

     <activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementLoadingActivity" android:theme="@android:style/Theme.Dialog">
         <intent-filter>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.LOADING"/>
             <category android:name="android.intent.category.DEFAULT"/>
         </intent-filter>
     </activity>
     <receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachReceiver" android:exported="false">
         <intent-filter>
             <action android:name="android.intent.action.BOOT_COMPLETED"/>
             <action android:name="com.microsoft.azure.engagement.intent.action.AGENT_CREATED"/>
             <action android:name="com.microsoft.azure.engagement.intent.action.MESSAGE"/>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.ACTION_NOTIFICATION"/>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.EXIT_NOTIFICATION"/>
             <action android:name="com.microsoft.azure.engagement.reach.intent.action.DOWNLOAD_TIMEOUT"/>
         </intent-filter>
     </receiver>
     <receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachDownloadReceiver">
         <intent-filter>
             <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
         </intent-filter>
     </receiver>


     <meta-data android:name="engagement:reach:notification:icon" android:value="ic_launcher"/>
     <meta-data android:name="engagement:gcm:sender" android:value="xxxxxxxxx\n" />

     <receiver android:name="com.my.package.engagementActivity.MyGCMEnabler" android:exported="false">
         <intent-filter>
             <action android:name="com.microsoft.azure.engagement.intent.action.APPID_GOT" />
         </intent-filter>
     </receiver>
    <receiver android:name=".MyGCMReceiver"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.my.package" />
        </intent-filter>
    </receiver>


</application>

0 个答案:

没有答案