Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

264
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda