android - 解析推送通知不适用于 android

标签 android push-notification parse-platform

我正在为我的 Android 应用程序使用解析推送通知。 我按照教程下载了 jar 文件,然后将其导入到我的项目中,并将这段代码添加到我的 list 中

<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>

我还添加了 application.class 到我的包中,代码是

public class Application extends android.app.Application {

    public Application() {
    }

    @Override
    public void onCreate() {
        super.onCreate();

        // Initialize the Parse SDK.
        Parse.initialize(this, "zzxxxxxxxxxxxxxxVv", "wyxxxxxxxCElxxxxxxx"); 

        // Specify a Activity to handle all pushes by default.
        PushService.setDefaultPushCallback(this, MainActivity.class);

        // Save the current installation.
        ParseInstallation.getCurrentInstallation().saveInBackground();
    }
}

在我的主要 Activity 中我这样做

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ParseAnalytics.trackAppOpened(getIntent());

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Log.e("MainActivity", "oncreate");
    setContentView(R.layout.activity_main);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

有人说 list 中的应用程序中的名称属性有问题,所以我用我的包名称添加了这一行

 <application
    android:name="com.test.pushnotificationTest.Application"

在解析仪表板时,当我将应用程序安装到新设备时,我在仪表板中获得了新条目..但是当我尝试发送推送通知时,我没有得到它。 我需要添加广播接收器吗??但它之前使用相同的代码没有广播 帮助我的人

最佳答案

解析 api 有时会滞后于 android 的推送消息传递... 当我签署我的 apk 时,我收到了推送通知。请使用已签署的 apk 再试一次。

关于android - 解析推送通知不适用于 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18592617/

相关文章:

azure - Azure 通知中心这么不稳定吗?

ios - 如何在 ios 推送通知中显示图像?

parse-platform - 使用 Parse 重新发送电子邮件验证

安卓 JNI 错误

android - 如何使用 React-vr 在 VR 模式下显示光标(十字线)?

Android 应用程序配置丢失且 Android Studio SDK 管理器不存在

android - GCM 推送通知。已发布错误通知 - 无法扩展 : StatusBarNotification 的 RemoteViews

ios - 在 viewDisappear 之前等待 saveInBackground Parse

ios - 解析+Swift, "-[Swift._NSContiguousString objectId]: unrecognized selector sent to instance"错误

android - 在 ImageView 中对齐图像左上角的 Logo