没有使用未注册来推动通知,我希望在某些情况下防止通知在Android通知中心显示。
从后端的无代码进行以下操作:
public class MyPushService extends BackendlessPushService
{
@Override
public boolean onMessage( Context context, Intent intent )
{
if (...) do something that shows the notif
else do something to hide the notif (not showing the notif at all)
}
@Override
public void onError( Context context, String message )
{
System.out.println(message);
}
}
来自:https://backendless.com/documentation/messaging/android/messaging_push_notification_setup_androi.htroi.html
实施 BackendlessPushservice类中的方法包含的逻辑 在Android通知中心显示推送通知。到 取消推送通知的默认处理,请确保您的 代码返回false。
即使我返回false,我仍然会看到通知,我如何防止这种行为?
请在github上关注文档:https://github.com/backendless/android-sdk/blob/master/master/master/docs/push.md.md
为了完成不显示推送通知,您需要执行以下操作:
- 覆盖
BackendlessPushService
并从onMessage()
返回false
方法 - 覆盖
BackendlessBroadcastReceiver
并从getServiceClass()
方法返回您的实现类 - 在
AndroidManifest.xml
中声明您的超级接收器
所有这些步骤均通过上述链接详细描述。