OneSignalPush notification tutorial



@Hossein @Ronin
sure i will share an example later on tonight…


Send Notifications with PHP

here is the example:

you have to upload your php file to a server with CURL support and change this lines:

line 4: content = message goes here.
line 6: app_id = app id given in app settings > keys & ids at onesignal . com.
line 8: headings = notification title goes here.
line 9: url = url that will be opened when tap notification. (if you don want to open a url when tapping notifications remove this line).
line 19: Authorization: Basic = rest api key given in app settings > keys & ids at onesignal . com.

this code will send notifications with the specified data on the file but
if you know php coding you can use $_GET[‘string’] to get data sended trought your app.

there are more options at the documentation in onesignal . com



Enviar Notificaciones por medio de PHP


Tienes que subir tu archivo php a un servidor con soporte CURL y cambiar estas lineas:

línea 4: content = aquí va el mensaje.
linea 6: app_id = aqui va la app id puedes verla en App Settings > Keys & Ids en onesignal . com.
linea 8: headings = aqui va el titulo de la notificacion.
linea 9: url = aqui va la url de la pagina que quieres que se abra al tocar la notificacion (si no quieres abrir una pagina quita esta linea).
linea 19: Authorization: Basic = aqui va la Rest Api Key puedes verla en App Settings > Keys & Ids en onesignal . com.

este código enviará notificaciones con los datos especificados en el archivo php pero
si conoces php puedes utilizar $ _GET [‘dato’] para obtener los datos enviados desde tu aplicación.

hay mas opciones en la documentación de onesignal . com


Push Notification Example?

@Lml_DLGdo thanks for your tutorial and code


@Adell_SE You can store a value on firebase (e.g. pushNot=1). When ever the app is opened to screen one/splash screen of app, you can check the value in firebase storage if it’s equal to 1, then you auto open screen 2 or any screen screen automatically from screen one.


@felixsarp are you referring to PushNotitication component or OneSignalPush notification??


@Lml_DLGdo, great! Thank you for the code. It is very helpful…


@Hossein Is it possible to send onesignal notifications using another app made using appybuilder? This was possible for firebase notifications.


@picanapicana see the post above by @Lml_DLGdo . haven’t tried myself, but seems like you can invoke server php to send.

I personally think OneSignal dashboard is the way to go. Why do you want to send from the app?


i want to make an admin app for managing the original app on the go. So we can send push notifications, and make other database updates.

It will be awesome for push notifications to work this way- admin opens the app, puts in text and/or image and presses the send button. And push notifications are sent to all devices. That’ll be cool!


@picanapicana Yes, this is possible but
You need to setup your own server and try to learn @Lml_DLGdo’s code.

I haven’t tried myself but i have read the code. You need to customise it to your need like catching POST data from App if you want to send push notif from App.

If you want more example or tutorials or sample code then maybe waiting for next few months will be good since there would be more people that have tried to do something with it. This is a new element so i guess that only few members that have tried to use OneSignal element.


yes is possible, sending data trough app and like @Ronin said catching post with php code…


@picanapicana @Ronin @Hossein

how do this looks?


@Lml_DLGdo can you screenshot the aia too? (y)


yes but you will need more than just the aia example.

the app sends the data to a php file in a server…

let me think how am i going to share my php source code. :grin:


cool! can you share the .aia file?


The video looks good, @Lml_DLGdo :+1:

It makes me want to try right away…


this component works also on the companion? I set up the whole thing but I don’t receive the notifications sent from OneSignal dashboard

EDIT: ok, I tried and it works only on builded apk. Is that intentional or I’m missing something?
Also, is it possible to open the app when the notification is clicked? Or just a url?


No, the API key is added to the manifest of the app which is created when the APK file is built, meaning that the API key can’t be changed dynamically i.e when using the companion.


That’s correct. We’ll update the help documentation to mention this


Thanks, any thought on this?