簡體   English   中英

在Android中未收到任何解析推送通知

[英]Not receiving any parse push notifications in Android

因此,我一直在嘗試設置Parse的推送通知。 我已經按照本教程以及SO上的其他線程進行了學習,但無法使其正常工作。 任何幫助都很好。 我有多種產品口味,所以我不能靜態輸入包裝名稱(或者可以嗎?)。 我可以從解析儀表板發送推送通知,但是我的手機沒有收到任何通知。

Application.class

ParseACL defaultACL = new ParseACL();
        ParseACL.setDefaultACL(defaultACL, true);

        ParseCrashReporting.enable(this);

        Parse.initialize(this, "xxxxxxxxxxxx", "xxxxxxxxxxx");


        ParseUser.enableAutomaticUser();
        ParseUser.getCurrentUser().saveInBackground();


        ParseInstallation.getCurrentInstallation().saveInBackground();
        ParsePush.subscribeInBackground("", new SaveCallback() {
            @Override
            public void done(ParseException e) {
            }
        });

表現

 <!--
  IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
  to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
    android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />

  <service android:name="com.parse.PushService" />
    <receiver android:name="com.parse.ParsePushBroadcastReceiver"
        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="${applicationId}" />
        </intent-filter>
    </receiver>

    <meta-data android:name="com.parse.push.notification_icon"
        android:resource="@drawable/ic_launcher"/>

因此,我終於想出了如何使其工作的方法,但是-我無法解釋原因。 我從該線程工作答案中得到了答案。

@Juven_v的答案是正確的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM