Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OneSignal group notification

I created a project on one signal.

I can send to php notification on my phone.

The problem comes when it arrives more than one notification. The new notification replaces the previous notification (not yet read ).

How do you get instead say that Android has 2 unread notifications?

The array can i send:

$fields = array(
  'app_id' => "XXXXXXXXXXXXXXXXXXXXXX",
  'included_segments' => array('All'),
  'data' => array("foo" => "bar"),
  'headings' => array("en" => "TEST"),
  'contents' => $content,
  'android_visibility' => '0',
  'priority' => '10',
  'android_group' => '',
  'android_group_message' => array("en" => "$[notif_count] message"),
  'url' => "http://www.google.it"
);

Thank you!

like image 560
Andrea php Avatar asked Sep 11 '25 22:09

Andrea php


2 Answers

Use single quotes or escape $ here if you want to use $ as character

'android_group_message' => array("en" => "\$[notif_count] message"),

OR

'android_group_message' => array("en" => '$[notif_count] message'),
like image 102
Niklesh Raut Avatar answered Sep 13 '25 13:09

Niklesh Raut


You can try to set value to 'android_group', like this:

'android_group' => 'sameGroup'
like image 22
Valentino Avatar answered Sep 13 '25 11:09

Valentino