无法将通知数据从 OneSignal 保存到 SQLite 数据库

Can't Save Notification Data to SQLite DB from OneSignal

无法从扩展应用程序 Class.

的 OneSignal 处理程序 Class 将数据保存到 android 设备上的数据库

如何将通知中收到的数据保存到我的 NotificationReceivedHandler 中的数据库中。我得到的数据库实例如下::

SQLiteOpenHelper helper = new DataBaseHelper(getApplicationContext());
SQLiteDatabase db = helper.getWritableDatabase();

此外,当设备处于前台时如何处理通知的打开,在这种情况下,通知显示为警报对话框。那么,如何检测通知是否是从应用程序的前台打开的?

我不确定你的 SQLite 问题。

Also, how to handle opening of notification when the device is in foreground, as in that case, the notification is shown as an Alert Dialog. So, how do I detect if the notification was opened from foreground of the app?

OSNotification instance sent to NotificationReceivedHandler 将有一个 isAppInFocus 属性,您可以使用它来检测此问题。