Collaboration between TinyDB components and OneSignalPush




some people here ask, how do you make it when a user receives pushnotification and then tapes the notification the user will be directed to open a certain screen.

at this time, using the OneSignalPush component can’t be done yet

I read the description in the OneSignal documentation, that the user can do this, of course with some adjustments to the AndroidManifest.xml file, and this is not possible to be applied in Appybuilder.

my curiosity, if the TinyDB component can work in a background, what if when the user receives pushnotification, and the NotificationOpenedHandler triggered, the rawPayload data can be stored in the TinyDB with the "rawPayload" tag, so that on the OneSignalPush component, features can be added to get the data . “customKey” will be found in the data, then with the “customKey” data the command to open a certain screen can be done.

class ExampleNotificationReceivedHandler implements NotificationReceivedHandler {
    private ExampleNotificationReceivedHandler() {

    public void notificationReceived(OSNotification notification) {
        JSONObject data = notification.payload.additionalData;
        String notificationID = notification.payload.notificationID;
        String title = notification.payload.title;
        String body = notification.payload.body;
        String smallIcon = notification.payload.smallIcon;
        String largeIcon = notification.payload.largeIcon;
        String bigPicture = notification.payload.bigPicture;
        String smallIconAccentColor = notification.payload.smallIconAccentColor;
        String sound = notification.payload.sound;
        String ledColor = notification.payload.ledColor;
        int lockScreenVisibility = notification.payload.lockScreenVisibility;
        String groupKey = notification.payload.groupKey;
        String groupMessage = notification.payload.groupMessage;
        String fromProjectNumber = notification.payload.fromProjectNumber;
        String rawPayload = notification.payload.rawPayload;
       	TinyDB tinyDB = new TinyDB();
    	tinyDB.StoreValue("payload", rawPayload);
        Log.d("OneSignalPush", "NotificationID received: " + notificationID);
        if (data != null) {
            String customKey = data.optString("customkey", null);
            if (customKey != null) {
                Log.d("OneSignalPush", "customkey set with value: " + customKey);

TinyDB tinyDB = new TinyDB();
tinyDB.StoreValue(“rawPayload”, rawPayload);
is used to store the rawPayload to TinyDB


In a normal Notification:
This needs to be done with .contentIntent:

Without it, the app would need to be running.

With OneSignal:
You can use the NotificationOpenHandler:


I mean, when the user taps the notification, it’s not immediately executed by the NotificationOpenedHandler to open another screen.
but what is done is to save the rawPayload data into the TinyDB, if possible.

In Appybuilder, as usual, when the user taps the notification, by default the application will open (Screen1), on Screen1 then the saved database is processed again by the OneSignalPush component to get the rawPayload data

is it not possible to store data on the TinyDB when PushNotification is received?
because i can’t directly edit the file to edit the NotificationOpenedHandler class