[OneSignal Plugin] [OneSignal Plugin] some problems of mine

[OneSignal Plugin] [OneSignal Plugin] some problems of mine

  
Forge Component
(9)
Published on 19 Oct by OutSystems R&D
9 votes
Published on 19 Oct by OutSystems R&D

(Actually I have another post few days ago, but no news since then. And since I have a new problem #1 not related to that, so I create this to summerize them all. Hopefully there'll be some good news)


This plugin works great, but there're some problems I've been struggling.



1. My handlers on notifications received and opened events only run at first launch of the application.

Meaning after I destroy the app (not in the background anymore), notifications still can be received but no data is processed.


There's a thread mentioned this [https://www.outsystems.com/forums/discussion/26472/deeplink-to-specific-screen-with-parameter/

but it's a bit old, and also just some work-around solutions for previous versions of this plugin



2. I've been trying sending some custom data along with notification. 

After looking around forum, it all comes to a solution of parsing raw payload manually from that notification.


The point is: 

I have no idea what is inside that raw payload?! 

Any format difference between Android and iOS?

(I only have an Android phone now, no iOS yet, but just want to know in advance)



Thank you

Solution

Hi Duy,

I just uploaded one sample app in forge. Hope it helps you!

1. Regarding the handlers, make sure that you have the OneSignal webblock in your Layout and LayoutBlank webblock (Splash screen makes use of LayoutBlank, and if OneSignal wrapper is not present there you won't may have problems with deeplinks redirection):


What do you mean with "notifications still can be received but no data is processed."?


2. Regarding payload you already had some previous interventions in the forum.

You can see an example in the sample, that make use of the payload to do some actions, in this example:



Hope it helps you.

Best regards,

Daniel Martins

Solution

Hi Martins,

Thank you for your reply and the sample app.


My apology, "...no data is processed" was a misinterpretation here, I didn't explain clearly my context

Because my handlers need to do some data processing & saving to local storage.


Just downloaded the sample, I'll try to figure out what I've doing wrong 


Thank you again.

Hello again,

after analyzed and updated the application, I still have problem #1


my opened handler is simple like this

here's my wrapper (embedded in both LayoutBlank and Layout)

my OnReady is simple as run EnableSubscription, and I also get following client action ran after user login


updated: I constantly get errors of "empty string", and no idea where it's been thrown from...


fyi, in ParseCustomData, I have a JS box like this


ps: few hours passed, and I don't know which way to go next...

Hi Duy!


Were you able to overpass your issue?

Hi Martins,
Sorry for a late response, I've been busy with some problems at home.


To be honest, the problem #1 is still there, no solution yet

still testing with application running since first launch.


And there's another problem, but I'll take some screenshots & describe later. 

'cause I'm changing the development environment, and it gets a bit messy here.

Hello, Duy,

Regarding problem #1 (that is, the app only triggers notification received events at first launch), I think I might have found a similar issue. Are you by chance using Register/RegisterWithUser only on the handler of your Login button?

If so, what's most likely happening is that, since your user is still logged in, you won't navigate through the Login screen, press the button and call the Register action, which initializes the listeners for those events.

In order to overcome this, I would add a call to the Register action on ApplicationStart. This will ensure that the plugin's listeners are properly initialized.

Would you try it out and let us know how it went?

Best regards,

Carlos Simões

Hi Simoes,

I think it's ApplicationReady, right?

And thanks to your suggestion, I think that problem is now resolved 


Just one thing isn't clear to me, what is the order of OnNotificationReceived & OnNotificationOpened?

Or they are separated events for separated interactions with notification?

Hi Duy,

Correct, the event is OnApplicationReady, this sample shows how to integrate with OneSignal plugin, and accordingly with the documentation and elements description in ServiceStudio:

  • OnNotificationReceived: a Client Action that runs when the app receives a notification.
  • Every time a notification is received and the application is running, this event is dispatched containing information about the notification that was received.

  • OnNotificationOpened: a Client Action that runs when the user opens a notification.
  • Every time a notification is opened by the user from the notification status, this event is dispatched and delivers information about the notification.


Please let me know if you need further details.

Best regards,
Daniel Martins

Duy Tonthat wrote:

Hi Simoes,

I think it's ApplicationReady, right?

And thanks to your suggestion, I think that problem is now resolved 

Yep, that was the one! Glad to hear! :)

Daniel made a good job explaning the events. I would only add that, if you're seeing a different behavior, it may be that either the plugin was modified, or there's a bug (not yet known).

Be sure to let us know if you need further assistance. Bear in mind that, since the plugin is supported, you can also open a support case to request help.

Best regards,

Carlos Simões