Question

Trying to add Push notifications with Parse. Debugging is telling me to add missing declarations in the manifest which are already there. Am I placing my code incorrectly in the manifest? (First app using android SDK) Ive followed Parse example code as close as possible, triple checked the tutorial and now about out of ideas

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.megger.cablecalcplustwo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <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.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <!--
      IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below
      to match your app's package name + ".permission.C2D_MESSAGE".
    -->
    <permission android:protectionLevel="signature"
        android:name="com.megger.cablecalcplustwo.pushnotifications.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.megger.cablecalcplustwo.pushnotifications.permission.C2D_MESSAGE" />



    <application



        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.Black.NoTitleBar">
        <activity
            android:name="com.megger.cablecalcplustwo.CableCalcActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity android:name="com.megger.cablecalcplustwo.CcActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.CalculatorActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.CablesActivity" android:label="@string/app_name" android:theme="@style/AlphaActivity"/>
        <activity android:name="com.megger.cablecalcplustwo.ContactActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideMultifunctionActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuidePatActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideLoopActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideInsulationActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideElectriciansActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuideClampActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.GuidePageActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.WebViewActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.AboutActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.VideoViewActivity" android:label="@string/app_name" android:configChanges="orientation" />
        <activity android:name="com.megger.cablecalcplustwo.VideoActivity" android:label="@string/app_name" />
        <activity android:name="com.megger.cablecalcplustwo.CompetitionsAndEvents" android:label="@string/app_name" />

        <service android:name="com.parse.PushService" />
        <receiver android:name="com.parse.ParseBroadcastReceiver">

            <intent-filter>


                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />

            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.GcmBroadcastReceiver"
            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" />

                <!--
                  IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
                -->
                <category android:name="com.megger.cablecalcplustwo.pushnotifications" />
            </intent-filter>
        </receiver>




        <compatible-screens>

            <screen android:screenSize="small" android:screenDensity="ldpi" />
            <screen android:screenSize="small" android:screenDensity="mdpi" />
            <screen android:screenSize="small" android:screenDensity="hdpi" />
            <screen android:screenSize="small" android:screenDensity="xhdpi" />

            <screen android:screenSize="normal" android:screenDensity="ldpi" />
            <screen android:screenSize="normal" android:screenDensity="mdpi" />
            <screen android:screenSize="normal" android:screenDensity="hdpi" />
            <screen android:screenSize="normal" android:screenDensity="xhdpi" />

            <screen android:screenSize="large" android:screenDensity="ldpi" />
            <screen android:screenSize="large" android:screenDensity="mdpi" />
            <screen android:screenSize="large" android:screenDensity="hdpi" />
            <screen android:screenSize="large" android:screenDensity="xhdpi" />

            <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
            <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
            <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
            <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />



        </compatible-screens>


    </application>
</manifest>

Logcat

05-14 18:04:52.415  29036-29055/com.megger.cablecalcplustwo E/com.parse.PushService﹕ Tried to use push, but this app is not configured for push due to: Push is not configured for this app because the app manifest is missing required declarations. Please add the following declarations to your app manifest to support either GCM or PPNS for push (or both). To enable GCM support, please make sure that these permissions are declared as children of the root <manifest> element:
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <permission android:name="com.megger.cablecalcplustwo.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="com.megger.cablecalcplustwo.permission.C2D_MESSAGE" />
    Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
    <service android:name="com.parse.PushService" />
    <receiver android:name="com.parse.GcmBroadcastReceiver" 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.megger.cablecalcplustwo" />
    </intent-filter>
    </receiver>
    To enable PPNS support, please make sure that these permissions are declared as children of the root <manifest> element:
    <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.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
    <service android:name="com.parse.PushService" />
    <receiver android:name="com.parse.ParseBroadcastReceiver">
    <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <action android:name="android.intent.action.USER_PRESENT" />
    </intent-filter>
    </receiver>
Was it helpful?

Solution

You should change all the places where it says com.megger.cablecalcplustwo.pushnotifications to com.megger.cablecalcplustwo, since that's your app's package name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top