Hi,
on one app which works OK with FCM i have the pushregister stuff in a hidden button"pnt" on the first card which i use as a splash.
But this can also be just in your Stack script(there was a bug one time where the pushregister did not work when called after another command, but it was solved with a newer LC version).
Code: Select all
on pushNotificationRegistered tSignature
if tSignature is not empty then
#answer "Registered for Push Notification:" && quote & tSignature & quote #disable when ok
put tSignature into URL ( "file:" & specialFolderPath("Documents") & "/regid.txt" )
put "yes" into URL ( "file:" & specialFolderPath("Documents") & "/fcmreceiveyesno.txt" )
end if
--answer tSignature
end pushNotificationRegistered
--on pushNotificationRegistrationError tMessage
--answer "Failed to Register for Push Notification:" && quote & tMessage & quote with "Okay"
--end pushNotificationRegistrationError
Then in the stack script i have this because it checks if the token is there and i made an option where the user can turn this push notification on or off, so it sends the key and a yes or no from the created txt files to my DB. (i believe this insert in front piece came from Richard Gaskin time ago)
Code: Select all
put specialFolderPath("Documents") & "/regid.txt" into tRegidFile
if there is not a file tRegidFile then
insert the script of button "pnt" into front
wait 1 second with messages
end if
Of course you can do it another way, but your script is OK.
Only the keys and a yes in my db will receive the push notification.
So i also created a windows app from where i will send the push notification to the keys with yes and it will count the nr of devices where it is send to(via the string received from FCM)
This returned fcm string also gives info about uninstalled devices or succes or canonical (keys of devices where the app is uninstalled should be removed)
I checked in the console: on your project there is the push send id 12 numbers and the app identifier, both have to match.
Then make sure that the image you use for the notification is only white on a transparent background(previous colors where allowed, not anymore), if you use a color image it won't work
So in your script you seem to miss nothing, but maybe in the standalone setting things may not match with your FCM project.
And you need your own key of course to send the push notification to your app.
Hope this helps a bit