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?
Push Notification question
@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??
@Hossein Is it possible to send onesignal notifications using another app made using appybuilder? This was possible for firebase notifications.
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!
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…
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.
cool! can you share the .aia file?
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?