操作解析推送通知在Android中 [英] Handling Parse Push Notifications in Android

查看:112
本文介绍了操作解析推送通知在Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为了处理推送通知我使用解析API。在我们的Andr​​oid应用程序,我要完成两件事情:

I am using Parse API in order to handle push notifications. In our Android application, I want to accomplish two things:

1),如果我们收到一个推送通知的应用程序被关闭,并在通知用户点击,我希望能够了解应用程序正在通过推送通知打开。

1) If we have received a Push Notification with the application is closed and the user clicks on the notification, I want to be able to understand that the application is being opened via a push notification.

2)如果我们收到一个推送通知,而应用程序是开放的,我要处理这个,做一些额外的工作。

2)If we receive a push notification while the application is open, I want to handle this and do some extra work.

在这两种情况下,我想知道,应用程序,以执行一些特殊的操作已收到一个推送通知。

In both cases, I want to be aware that the application has received a push notification in order to execute some special operations.

据我从解析API单证理解,它提供了处理两种方式推压:与活动响应,并与意向响应。目前我打电话

As far as I understand from Parse API documentations, it offers two methods of handling pushes: Responding with an Activity and Responding with an Intent. I am currently calling

PushService.setDefaultPushCallback(context, MainActivity.class);

在在AndroidManifest.xml文件所需的变化,已经是我的应用程序类收到推送通知,这相当于与活动的方法应对。但我不知道怎么知道推送通知明确地用这种方法的。

in my Application class with needed changes in the AndroidManifest.xml file and already receive push notifications, this corresponds to Responding with an Activity method. But I don't know how to be aware of Push Notifications explicity with this method.

先谢谢了。

推荐答案

在收到一推,检查

1:无论我们的应用程序是在前台或后台

1:Whether our application is in foreground or background.

如果是前台,这意味着应用程序是可见的,做你的东西(显示警报或任何你想要的)。

If it is foreground, that means app is visible and do your stuff(show alerts or anything you want).

如果应用程序是在后台,这意味着它是不可见的,如果你想要做在此基础上的任何东西。

If app is in background,that means it is not visible and if you want to do any thing based on this.

我希望这有助于..

这篇关于操作解析推送通知在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆