I realized there was a bug in the PushNotifications package.
The native app tries to create a DeviceRegistration object, which raises a Before commit event on that entity.
In that event, it checks whether the referred device already exists, and if not, tries to create it. That’s the point where it fails.
If you run that app as a Custom Developer App, you’ll be able to see the logs in which it is said: “Failed to synchronize object 23423765823. Failed to commit. bla bla bla”.
And from the device’s point of view, that’s all you got.
But if you place a breakpoint in that Before commit event from entity DeviceRegistration, you’ll see that it never passes the Create object activity for creating the Device object.
That exception is kept hidden, it is not thrown. The event handler just returns a false and nothing gets written.
I setup error handling in that Create activity and I could see in the $latestError object that it was mentioning errors inside Mendix Java functions. Something regarding not being able to leave a Boolean value null/empty (which is quite strange as that entity has a default value set for the only Boolean field, which is IsHybrid).
So I changed the argument being passed to field IsHybrid to a constant false. And it solved it!
Well, obviously that’s a hack. So I changed it to $DeviceRegistration/IsHybrid. And it worked!
I’m not sure what was the original value but I suppose it was $Device/IsHybrid, which would be null/empty, as $Device does not exist at that point.
I downloaded it back again just to check and indeed, that was the error:
That is possibly the same issue for you.
Other than that, are you running that as a free app (i.e in the sandbox)?
Because I found out the sending process is a scheduled event, which is a feature unavailable in sandboxes.
Yes, I'm using the sandbox but we can directly use the SendMessages microflow to trigger the push notification