Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
How to add Title in One Signal push notifications for Web App?

The below PHP code for Onesignal push notification is working fine,

But how do I add Title to the notification along with a defined custom icon instead of the default bell?

//Push Notifications Starts User --------------------------------------------------------------
            
            notify("Alert","Your Order status has been changed to '$order_status'.");
            $content = array("en" => "Your Order status has been changed to '$order_status'.");
            $fields = array(
                'app_id' => "fa0e5f20-xxxxxxxxxxxxxxxxxxxx",
                'included_segments' => array('All'),
                'contents' => $content,
                'data' => array("en" => "bar"),
                'large_icon' =>"ic_launcher_round.png",
            );
            
            $fields = json_encode($fields);
            
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json; charset=utf-8',
                'Authorization: Basic NTBjNDExxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
            ));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            curl_setopt($ch, CURLOPT_HEADER, FALSE);
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            
            $response = curl_exec($ch);
            curl_close($ch);
            
        //Push Notifications Ends --------------------------------------------------------------

Please note that "ic_launcher_round.png" is in my studio sdk inside folders "res->mipmap->ic_launcher_round"

The push is working, but I need the Title on top of the content along with 'ic_launcher_round.png' as a custom icon.

Any help is greatly appreciated.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda