有没有办法使用及何时从拦截我的通知使解析QUOT;警报"键? [英] Is there a way to keep parse from intercepting my notifications when using "alert" key?

查看:117
本文介绍了有没有办法使用及何时从拦截我的通知使解析QUOT;警报"键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的解析来发送和处理Android和iOS的通知。我不想处理大约不同的发送通知或者iOS或​​Android的一部分,因为它是不容易判断用户使用何种设备或操作系统。一个用户可以同时拥有和使用的应用程序在两个生态系统,所以我要发出这两个Android和iOS工作的通知。

I am using parse to send and handle notifications for android and ios. I don't want to handle the part about sending the notification differently for either ios or android because it is not easy to determine what device or operating system a user is using. A user could have both and use the app on both ecosystems, so I want to sent out notifications which work on both android and ios.

到目前为止,我已经成功了,这两种类型的设备得到了通知。 Android和解析的是,该分析是pretty固执。当使用警告或标题键,然后解析显示通知之前,我的广播接收器得到处理它。

So far I have succeeded, both device types get a notification. The thing with android and parse is, that parse is pretty stubborn. When the "alert" or the "title" key is used, then parse displays the notification before my BroadcastReceiver gets to handle it.

我做了一些研究,我的理解,改变由警戒的东西的关键人这样做的伎俩。我的问题是,我必须使用警惕不管是什么,以保持它在iPhone上运行。有没有别的我可以做,并让我的广播接收器,而不解析截获通报的东西吗?

I did some research and to my understanding, changing the key from "alert" to something else does the trick. My problem is, I have to use "alert" no matter what to keep it working on iphones. Is there something else I could do and keep my BroadcastReceiver without parse intercepting the notification?

有没有办法改变警报键,仍保持在IOS / iPhone的功能?

Is there a way to change the "alert" key and still maintain functionality under ios/iphones?

先谢谢了。

推荐答案

我能够在云code iOS和Android做两个不同的调用Parse.Push.send()来解决这个问题。

I was able to address this issue by making two different calls to Parse.Push.send() in CloudCode for iOS and Android.

// iOS
query.equals("deviceType", "ios");
data = {"alert":"some alert", "data":{other params here}};
Parse.Push.send({
    where: query,
    data: data
}

// Android
query.equals("deviceType", "android");
data = {"data":{"alert":"some alert", other params here}, "action":"com.mycompany.customBroadcastReceiver_actionId"};
Parse.Push.send({
    where: query,
    data: data
}

对于Android,移动警戒(和称号如果适用)从顶层参数对数据PARAMS将继续解析的PushService截取推notif和创建自己的状态栏通知中。

For Android, moving "alert" (and "title" if applicable) from the top level parameters to within your data params will keep Parse's PushService from intercepting the push notif and creating its own status bar notification.

您现在可以禁用解析的接收器,并通过自定义的广播接收器(用行动参数标识)自己实现的通知。一个黑客的善良,但我需要定制notifs,并有不似乎是另一种方式来窃听他们规避解析的PushService如果有警告或题集。

You can now disable Parse's receiver and implement the notifications yourself through a custom broadcast receiver (identified by the "action" parameter). Kind of a hack, but I need custom notifs, and there doesn't seem to be another way to circumvent Parse's PushService from intercepting them if you have alert or title set.

这篇关于有没有办法使用及何时从拦截我的通知使解析QUOT;警报"键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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