解析推送通知未收到

时间:2016-01-30 10:52:48

标签: android parse-platform push-notification

我正试图从Android上的解析获得推送通知。

尝试在parse.com上进行推送通知教程并在线搜索其他ppls解决方案,但无济于事。

有人可以帮忙。

这是我在android studio上的日志。

table =({ord(k):ord(ch) for k ,v in d.items() for ch in v})

s.translate(table)

我已经完成了所需的权限                                   

I/art: Late-enabling -Xcheck:jni
I/GMPM: App measurement is starting up, version: 8487
I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
E/GMPM: Scheduler not set. Not logging error/warn.
E/GMPM: Uploading is not possible. App measurement disabled
V/com.parse.ParseHttpClient: Using net.java.URLConnection library for networking communication.
V/com.parse.ManifestInfo: Cannot use GCM for push because the app manifest is missing some required declarations. Please make sure that these permissions are declared as children of the root <manifest> element:
V/com.parse.ManifestInfo: Using none for push.
V/com.parse.CachedCurrentInstallationController: Successfully deserialized Installation object
V/com.parse.ParsePushChannelsController: Tried to subscribe or unsubscribe from a channel, but push is not enabled correctly. 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 use GCM for push: make sure that these permissions are declared as children of the root <manifest> element:
D/OpenGLRenderer: Render dirty regions requested: true
D/Atlas: Validating map...
Successfully subscribed to Parse!
I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Enabling debug mode 0
W/art: Suspending all threads took: 17.321ms

这是我的解析配置代码 Parse.enableLocalDatastore(getApplicationContext());         Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);         Parse.initialize(getApplicationContext(),AppConfig.PARSE_APPLICATION_ID,AppConfig.PARSE_CLIENT_KEY);

<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality. 
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application>
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />


    <service android:name="com.parse.PushService" />
    <receiver android:name="com.parse.ParseBroadcastReceiver"
        android:exported="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>
    <receiver
        android:name=".CustomPushReceiver"
        android:exported="false"
        >
        <intent-filter>
            <action android:name="com.parse.push.intent.RECEIVE" />
            <action android:name="com.parse.push.intent.DELETE" />
            <action android:name="com.parse.push.intent.OPEN" />
        </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.starter" to match your app's package name.
            -->
            <category android:name="{package name" />
        </intent-filter>
    </receiver>

    <permission android:name="{package name}.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="{package name}.permission.C2D_MESSAGE" />

    <!--
    <service android:name="com.parse.PushService" />

    <receiver
        android:name=".CustomPushReceiver"
        android:exported="false"
        android:enabled="true">
        <intent-filter>
            <action android:name="com.parse.push.intent.RECEIVE" />
            <action android:name="com.parse.push.intent.DELETE" />
            <action android:name="com.parse.push.intent.OPEN" />
        </intent-filter>
    </receiver>-->
</application>

这是我的定制推送接收器 公共类CustomPushReceiver扩展了ParsePushBroadcastReceiver {

    //Security of data
    ParseACL defaultACL = new ParseACL();
    // If you would like objects to be private by default, remove this line.
    defaultACL.setPublicReadAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);

    ParseInstallation installation = ParseInstallation.getCurrentInstallation();
    installation.put("device_id", mPhoneNumber);
    installation.saveInBackground();

    ParsePush.subscribeInBackground(AppConfig.PARSE_CHANNEL, new SaveCallback() {
        @Override
        public void done(ParseException e) {
            Log.e("Non-emergencyambulance", "Successfully subscribed to Parse!");
        }
    });

}

0 个答案:

没有答案