简体   繁体   English

Google Cloud Messaging推送通知(带有Urban Airship)仅在Android 4.0+上显示,而不在2.3 Gingerbread上显示

[英]Google Cloud Messaging push notifications (with Urban Airship) only show on Android 4.0+ , not 2.3 Gingerbread

In this setup I'm using Urban Airship for the backend, GCM to push the notifications and then a small array of 2.3/4.0/4.1+ devices. 在此设置中,我将使用Urban Airship作为后端,使用GCM来推送通知,然后使用一小组2.3 / 4.0 / 4.1 +设备。

All devices register successfully with GCM (I can confirm this in the console). 所有设备都已成功向GCM注册(我可以在控制台中确认这一点)。 Urban Airship also has no problem sending the notifications, the API keys are set up correctly. 城市飞艇也没有问题发送通知,API密钥已正确设置。

Therefore I think something might be wrong with the manifest file as the 2.3 device never receives the notification. 因此,我认为清单文件可能出了一些问题,因为2.3设备从未收到通知。 All the other 4.0 devices receive them, just not the 2.3 device. 所有其他4.0设备都会收到它们,而2.3设备不会。 It could be a problem with that particular device but I only have the one 2.3 device to test with. 该特定设备可能有问题,但我只有一个2.3设备可供测试。

Would anyone mind having a look at the Android manifest file to see if I've made an obvious error? 有人介意查看Android清单文件以查看我是否犯了明显的错误吗?

Much appreciated. 非常感激。

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="10"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>

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

<!-- Only this application can receive the messages and registration result -->
<permission
        android:name="com.mycompany.MyTest.permission.C2D_MESSAGE"
        android:protectionLevel="signature"/>


<uses-permission android:name="com.mycompany.MyTest.permission.C2D_MESSAGE"/>
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<application
        android:name="com.mycompany.MyTest.MyTestApplication"
        android:hardwareAccelerated="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name">
    <activity
            android:name="com.mycompany.MyTest.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
            android:name="com.mycompany.MyTest.activity.PhotoBrowserActivity"
            android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.SHOW_PHOTO_BROWSER"/>

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

    <!-- <activity -->
    <!-- android:name=".activity.testContentActivity" -->
    <!-- android:screenOrientation="portrait" -->
    <!-- android:theme="@android:style/Theme.NoTitleBar"> -->
    <!-- <intent-filter> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_PHOTO_GRID"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_FEED_PHOTO_GRID"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_PLAYER_PROFILE"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_FEED_NEWS"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_FEED_PODCAST"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_FEED_LATEST_VIDEO"/> -->
    <!-- <action android:name="com.mycompany.MyTest.SHOW_test_CONTENT_FEED_HIGHLIGHTS"/> -->


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

    <activity
            android:name="com.mycompany.MyTest.info.CustomActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.info.PushNotificationSettings"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name=".stats.PlayerProfilesListActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.stats.refactored.tables.TableActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@android:style/Theme.NoTitleBar">
    </activity>
    <activity
            android:name="com.mycompany.MyTest.matches.MatchesSettingActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.matches.matchcentre.MatchcentreActivity"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.news.refactored.full.NewsActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.START_NEWS"/>

            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>
    <activity
            android:name="com.mycompany.MyTest.news.refactored.full.VideoPlaybackActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.activity.PhotosBrowserActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
            android:name="com.mycompany.MyTest.info.WallpapersActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"/>

    <!-- Receiver for audio player -->

    <receiver android:name="com.mycompany.MyTest.news.refactored.full.AudioPlayerBroadcastReceiver">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.AudioCommentaryBroadcastReceiver.STOP_AUDIO_PLAYBACK"/>
        </intent-filter>
    </receiver>

    <activity
            android:name=".stats.refactored.players.PlayerProfileDetails"
            android:label="@string/title_activity_player_profile_details"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <!-- Widget -->


    <!-- Widget providers -->

    <activity
            android:name="com.mycompany.MyTest.widget.ConfigurationActivityScores"
            android:process=":com.mycompany.MyTest.widget.process"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
        </intent-filter>
    </activity>

    <receiver
            android:name="com.mycompany.MyTest.widget.AppWidgetProviderScores4x1"
            android:label="test Fixtures (small)"
            android:process=":com.mycompany.MyTest.widget.process">
        <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidgetprovider_scores_4x1"/>

        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
        </intent-filter>
    </receiver>
    <receiver
            android:name="com.mycompany.MyTest.widget.AppWidgetProviderScores4x2"
            android:label="test Fixtures (large)"
            android:process=":com.mycompany.MyTest.widget.process">
        <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidgetprovider_scores_4x2"/>

        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
        </intent-filter>
    </receiver>

    <!-- Was not included in specification -->
    <!--
                <receiver android:name=".widget.AppWidgetProviderScores4x4"
                android:process=":com.mycompany.MyTest.widget.process">
                <meta-data android:name="android.appwidget.provider"
                    android:resource="@xml/appwidgetprovider_scores_4x4"/>
                <intent-filter>
                    <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
                </intent-filter>
            </receiver>
    -->

    <receiver
            android:name="com.mycompany.MyTest.widget.AppWidgetProviderNews4x1"
            android:label="test News"
            android:process=":com.mycompany.MyTest.widget.process">
        <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/appwidgetprovider_news_4x1"/>

        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
        </intent-filter>
    </receiver>

    <!-- End of widget providers -->


    <!-- Widget services -->

    <receiver
            android:name="com.mycompany.MyTest.widget.AppWidgetUpdateServiceManager"
            android:process=":com.mycompany.MyTest.widget.process">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.widget.REGISTER_WIDGET_TYPE"/>
            <action android:name="com.mycompany.MyTest.widget.UNREGISTER_WIDGET_TYPE"/>
            <action android:name="com.mycompany.MyTest.widget.START_UPDATE_SERVCIE"/>
            <action android:name="com.mycompany.MyTest.widget.CHANGE_UPDATE_SERVCIE_INTERVALS"/>
            <action android:name="com.mycompany.MyTest.widget.STOP_UPDATE_SERVCIE"/>
            <action android:name="com.mycompany.MyTest.widget.REFRESH_WIDGET"/>
        </intent-filter>
    </receiver>

    <service
            android:name="com.mycompany.MyTest.widget.AppWidgetUpdateServiceScores"
            android:label="WidgetUpdateServiceScores"
            android:process=":com.mycompany.MyTest.widget.process">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.widget.scores.UPDATE_APP_WIDGETS"/>
            <action android:name="com.mycompany.MyTest.widget.scores.NEXT_WIDGET_CONTENT"/>
            <action android:name="com.mycompany.MyTest.widget.scores.PREVIOUS_WIDGET_CONTENT"/>
            <action android:name="com.mycompany.MyTest.widget.scores.REFRESH_WIDGET"/>
        </intent-filter>
    </service>
    <service
            android:name="com.mycompany.MyTest.widget.AppWidgetUpdateServiceNews"
            android:label="WidgetUpdateServiceNews"
            android:process=":com.mycompany.MyTest.widget.process">
        <intent-filter>
            <action android:name="com.mycompany.MyTest.widget.news.UPDATE_APP_WIDGETS"/>
            <action android:name="com.mycompany.MyTest.widget.news.NEXT_WIDGET_CONTENT"/>
            <action android:name="com.mycompany.MyTest.widget.news.PREVIOUS_WIDGET_CONTENT"/>
            <action android:name="com.mycompany.MyTest.widget.news.REFRESH_WIDGET"/>
        </intent-filter>
    </service>

    <!-- End of Widget services -->


    <!-- End of widget -->


    <!-- REQUIRED -->



    <receiver android:name="com.urbanairship.CoreReceiver">

        <!-- REQUIRED IntentFilter - For Helium and Hybrid -->
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            <action android:name="android.intent.action.ACTION_SHUTDOWN"/>
        </intent-filter>
    </receiver>

    <!-- REQUIRED for Urban Airship GCM -->
    <receiver android:name="com.urbanairship.CoreReceiver" />
    <receiver
        android:name="com.urbanairship.push.GCMPushReceiver"
        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" />

            <!-- MODIFICATION REQUIRED - Use your package name as the category -->
            <category android:name="com.mycompany.MyTest.MyTestApplication" />
        </intent-filter>
        <!-- REQUIRED for detecting when the application is upgraded so it can request a new GCM ID -->
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REPLACED" />

            <data android:scheme="package" />
        </intent-filter>
    </receiver>

    <service
        android:name="com.urbanairship.push.PushService"
        android:label="Push Notification Service" />
    <!-- REQUIRED only with UA Android lib version 2.1.4 and earlier. Do not include PushWorkerService with UA Android lib version 3.0.0+ since it has been deprecated -->

    <service
        android:name="com.urbanairship.analytics.EventService"
        android:label="Event Service" />

    <!-- This is required for persisting preferences related to push and location -->
    <!-- MODIFICATION REQUIRED - Use your package name + ".urbanairship.provider" in the android:authorities -->
    <provider
        android:name="com.urbanairship.UrbanAirshipProvider"
        android:authorities="com.mycompany.MyTest.urbanairship.provider"
        android:exported="false"
        android:multiprocess="true" />
    <!-- END OF REQUIRED ITEMS -->


    <!-- OPTIONAL, if you want to receive push, push opened and registration completed intents -->
    <receiver android:name="com.mycompany.MyTest.gcm.IntentReceiver"/>

    <!-- End of C2DM -->

</application>

Maybe try to change : 也许尝试改变:

<category android:name="com.mycompany.MyTest.MyTestApplication" />

by : 创建人:

<category android:name="com.mycompany.MyTest" /> <!-- Just the package name of you app -->

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM