How can I make OneSignal automatically get the Player ID when the app starts?



Hi everyone :waving_hand:
I have a Kodular app using WebView that loads my website (PHP system).
I’m trying to make OneSignal automatically capture the Player ID from the app and send it to my server, but it only works manually when I test with scripts.

Here’s what I’m using now:

  • My app uses WebView to load a dashboard (admin/index.php?page=dashboard).
  • I have the OneSignal_Notifications component enabled.
  • I tried using the block:
when OneSignal_Notifications1.Push Subscription State Changed
  subscription Id: subscriptionId
  opted In: optedIn
  token: token
do
  set Web1.URL to "https://portal.loopapps.com.br/admin/api/salvar_player.php"
  call Web1.PostText
    text: join "player_id=" subscriptionId
  • The PHP endpoint works fine and saves the ID correctly.
  • The problem is: the app doesn’t automatically trigger this event, so I can’t get the Player ID when the user first opens the app.

I’d like to know:

  1. How can I make OneSignal automatically get the Player ID when the app starts (without user clicking anything)?
  2. Do I need to request notification permissions first (for Android 13+)?
  3. Is there a better way to handle this inside a WebView-based app?

Any help or working examples would be amazing :folded_hands:
Thanks in advance!

Hi dear,

Maybe you’ve already tried it, but it never hurts to ask, have you tried connecting this block instead?