CloudObjects / Directory / Firebase Integration / FCM Register API 1.0
Sign in

FCM Register API 1.0

a phpmae:ControllerClass, agws:WebAPI & phpmae:Class in Firebase Integration

The FCM Register API is used to store a device registration for Firebase Cloud Messaging on the Account Gateway. This API needs to be mounted for Android, iOS, Chrome or web applications that want to use FCM via CloudObjects.

Public PHP Methods
  • connect(Application $app)

    No documentation available.

Source Code

use Silex\Application, Silex\Api\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;

 * Implementation for coid://
class FCMRegisterAPI implements ControllerProviderInterface {

  public function connect(Application $app) {
    $controllers = $app['controllers_factory'];

    $controllers->post('/storeRegistrationId', function(Request $r) use ($app) {
      if (!$r->request->has('registration_id'))
        $app->abort(400, "Parameter 'registration_id' required.");

      // Add attributes to account connection
      $connection = $app['context']->getAccountConnection($app['context']->getInstallQualifier());
      if (!isset($connection))
        $app->abort(500, "API was called without install qualifier.");

      $connection->setProperty('coid://', 'true');
      $connection->setProperty('coid://', $r->request->get('registration_id'));

      // Store data

      return $app->json(array(
        'ok' => true

    return $controllers;
coid:// content_copy
6-ea01ed2965c9d018657194ef9f3deb4b content_copy
Last updated
2017-02-14 11:34 (UTC)
Usage permission