You are here

public function FirebaseGroupManagerService::removeFromGroup in Firebase Push Notification (FCM) 8

Same name and namespace in other branches
  1. 3.0.x src/Service/FirebaseGroupManagerService.php \Drupal\firebase\Service\FirebaseGroupManagerService::removeFromGroup()

Method for removing devices from existing group.

Parameters

string $groupName: Unique name for the group of devices.

string $groupToken: The token for identify group in FCM.

array $deviceTokens: Device or devices tokens, which should be combined into one group.

Return value

bool|array Result from FCM.

File

src/Service/FirebaseGroupManagerService.php, line 115

Class

FirebaseGroupManagerService
Service for managing device groups.

Namespace

Drupal\firebase\Service

Code

public function removeFromGroup($groupName, $groupToken, array $deviceTokens) {
  if (!$groupName || empty($deviceTokens) || !$groupToken) {
    return FALSE;
  }
  $this->body = [
    'operation' => 'remove',
    'notification_key_name' => $groupName,
    'notification_key' => $groupToken,
    'registration_ids' => $deviceTokens,
  ];
  return $this
    ->send();
}