2015-11-12 4 views
1

Так что я пытался настроить push-уведомления Parse. Я следил за учебником, а также за другие темы на SO, но просто не могу заставить его работать. Любая помощь будет большой. У меня есть несколько разновидностей продуктов, поэтому я не могу статически поставить имя пакета (или я могу? .....). Я могу отправлять push-уведомления из панели анализа синтаксиса, но я не получаю никаких уведомлений на своем телефоне.Не получать уведомления о синтаксическом разборе в Android

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) { 
      } 
     }); 

Manifest

<!-- 
    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"/> 

ответ

0

Так что я наконец-то понял, как заставить его работать, НО - я не могу объяснить, почему. Я получил ответ из этой темы Working Answer.

@Juven_v ответ был верным.

Смежные вопросы