简体   繁体   English

没有通过parse.com在android上接收推送通知

[英]Not receiving push notification on android with parse.com

I am very new to android app development. 我是Android应用程序开发的新手。 I am using parse.com for my backend, and I have followed the tutorial https://www.parse.com/tutorials/android-push-notifications to set up push notifications. 我使用parse.com作为后端,我已按照教程https://www.parse.com/tutorials/android-push-notifications设置推送通知。 However, whenever I send a notification using parse notification console (on the website) or from an android device, I do not receive any notification. 但是,每当我使用解析通知控制台(在网站上)或从Android设备发送通知时,我都不会收到任何通知。 Secondly, on the parse notification console, each notification shows 0 as pushes sent. 其次,在解析通知控制台上,每个通知在发送推送时显示0。 And when I checked the registration ID in the deviceToken field of the app's current ParseInstallation, it is empty. 当我在app的当前ParseInstallation的deviceToken字段中检查注册ID时,它是空的。 Even GCMSenderID is empty. 甚至GCMSenderID都是空的。 So I am suspecting that my app is not getting registered properly, but installationID field is not empty. 所以我怀疑我的应用程序没有正确注册,但installID字段不为空。 I have added all permissions and credentials in the manifest file. 我已在清单文件中添加了所有权限和凭据。

Please help me. 请帮我。 It will be a big help. 这将是一个很大的帮助。 Thank you :) 谢谢 :)

Here's my Manifest file: 这是我的清单文件:

<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" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!--
  IMPORTANT: If you change the package name of this sample app, change
  "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the
  lines below to match the new package name.
-->
<permission
    android:name="com.parse.swipeit.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.parse.swipeit.permission.C2D_MESSAGE" />

<application
    android:name="com.parse.swipeit.Application"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.parse.swipeit.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <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: If you change the package name of this sample app,
              change "com.parse.tutorials.pushnotifications" in the lines
              below to match the new package name.
            -->
            <category android:name="com.parse.swipeit" />
        </intent-filter>
    </receiver>
</application>

This part is important. 这部分很重要。

<!-- IMPORTANT: Change "com.parse.starter" to match your app's package
 name. -->

You need to use the Google developer console to enable the Google Cloud Messaging api for you. 您需要使用Google开发者控制台为您启用Google Cloud Messaging API。 For that, you'll need to use your own unique valid package name (that only belongs to you and no one else). 为此,您需要使用自己唯一的有效包名称(仅属于您而不属于其他人)。

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

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