Android - how can I send notifications

Android - how can I send notifications from the game I made to the user’s device

2 Likes

I don’t think it’s possible with normal events. You may have to try it with javascript (sorry I don’t know it so I can’t help with that) but there is an extension called popups, where you can make popups/errors appear on the screen.

I made this extension, it does exactly what you want, you can send device notifications and in app notifications using Onesignal

I tried it without success. It does not create a user on the site and does not subscribe

Did you turn on notifications in the app settings on your phone? It’s required for android 13 and i think 12 devices.

YES, I gave permission, but is says no Subscribed Users

Okay, I’d take a look at it again. Also did you add the action to initialize the extension, and did you place your key in there?

yes🙏 i add the extension, and i place my key, thanks you!
How can I request permission for an notifications from the user as soon as enter to the application?

Hey, I just updated the extension, it now uses one signal 5.0.0, I’ve added the action you requested.

You can download the update in the PR or in this gist →

Hello,
Thank you for your amazing contribution.
I am trying to integrate the extension but somehow I am not able to register new subscribers.
I followed the guide bellow

1/ Activate Firebase Cloud Messaging API (V1)
2/ Generate a Private Key JSON file (Node.js)
3/ Activate the platform Google Android (FCM) in OneSignal (In the part “Select SDK” I tried both Native android and Cordova)
4/ Download and import the extention in Gdevelop (Onesignal GDevelop Extension · GitHub)
5/ Integrate it as follow :
Beginning of the first scene >

  • Request Notification Permission : TRUE
  • Initialize Onesignal (My app ID + user must consent TRUE)
    I tried the application using mobile manual build and mobile One-click packaging. I tested the .apk in a real phone and in android studio virtual devices (with playstore installed).
    I checked, the notification is allowed.
    But still, when I launch the application no new subscriber is registered in OneSignal.
    Thank you in advance for your precious time.

Hello, I also cannot seem to get this to work… Would you possibly be able to make a video on this topic that we can follow? It would be greatly appreciated. I specifically would want a push notification to be sent to one phone if someone on a different phone sneds them something. I understand your time is valueable so if you cannot make a video on this topic it is not a problem.

Even if I did get this to work, I’m not sure I understand how to even send a push notification with the actions available with the extension… is this extension capeable of sending push notifications in IOS/ Andriod when a player is completely offline? I would like the push notifications to be sent out if another player initiated it (like you could “nudge” your friend to get on). Any guidance on this topic would be very appreciated and I appreciate the work youve already done in the Gdevelop community

Hello, I think the platform “oneSignal” made some major changes recently. I doubt this extension would work.

At the time of creating the extension, you could not send push notifications when the player was offline, sending notifications required you to make use of the one signal dashboard.

I can take a look and fix the extension.

1 Like

Hi there, just showing my interest in this extension. I’m afraid I can’t help in making it work as my coding knowledge is really poor, but if I can help with testing I’ll be happy to. I’m currently making a Tamagotchi-like game so push notifications would be a must, ideally even when the app is closed but as far as I know it is not possible right ?