我知道我可以收到它们,Broadcast OnReceive()但我不能阻止Onesignal创建一个Notification.
您需要设置OneSignal NotificationExtenderService类并将其添加到您AndroidManifest.xml的a Service.
import com.onesignal.OSNotificationPayload;
import com.onesignal.NotificationExtenderService;
public class NotificationExtenderBareBonesExample extends NotificationExtenderService {
@Override
protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
// Read properties from result.
// Returning true tells the OneSignal SDK you have processed the notification and not to display it's own.
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
AndroidManifest.xml
<service
android:name=".NotificationExtenderBareBonesExample"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false">
<intent-filter>
<action android:name="com.onesignal.NotificationExtender" />
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅OneSignal Android 背景数据和通知覆盖文档.
| 归档时间: |
|
| 查看次数: |
3136 次 |
| 最近记录: |