Skip to main content

Posts

Showing posts from September, 2020

Managing Firebase Cloud Messaging Device Groups with Node.js

  Understanding Device Groups Device groups work by collecting the registration tokens for all of the app clients that are to be included and assigning this group a notification key. This key is then used when sending messages to the group in much the same way that messages are sent to topic subscribers. Once created, registration tokens may be added to or removed from the group as needed. A device group can be created on the server (for example using Node.js) or within the client app. In both cases, the process essentially involves using HTTP to post a request to the Google cloud messaging servers containing information relating to the device group.  Requirements for Creating a Device Group Before a device group can be created the following information will need to be gathered: • Registration tokens for all device group members • The cloud messaging server key for the Firebase project • The cloud messaging sender ID for the Firebase project • A notification key name for the device gro

Sending Firebase Cloud Messages from a Node.js Server

  Installing the Firebase Admin SDK Since the Node.js code written in the remainder of this chapter is going to make extensive use of the Firebase Admin SDK the next step is to install this module using the npm command. Remaining in the directory containing the package.json file, install the module library as follows: npm install firebase-admin --save A sub-directory named node_modules containing the firebase-admin module will have been created and a review of the package.json file will show that the firebase-admin module is now listed as a dependency for the current project: . . "dependencies": { "firebase-admin": "^5.0.0" . . Generating the Service Account Credentials Before any Firebase cloud messages can be sent using Node.js, an additional JSON file needs to be generated and installed on the server. This file contains a private key that allows Node.js code to communicate through the SDK to the Firebase messaging service and is generated from wit

Angular 10|9|8 Google Maps with Places Search and Draggable Marker using Angular Google Maps (@agm/core)

 1. Install Angular Google Maps To use Google Maps in Angular application, install the @agm/core package Run the following command to install AGM in Angular Install Types for GoogleMaps $ npm install @types / googlemaps -- save - dev Update App Module Next, open the  app.module.ts  file, import  AgmCoreModule  then update the  imports  array import { BrowserModule } from '@angular/platform-browser' ; import { NgModule } from '@angular/core' ; import { AppComponent } from './app.component' ; import { AgmCoreModule } from '@agm/core' ; @ NgModule ( { declarations : [ AppComponent ] , imports : [ BrowserModule , AgmCoreModule . forRoot ( { apiKey : 'YOUR-API-KEY-HERE' , libraries : [ 'places' ] } ) ] , providers : [ ] , bootstrap : [ AppComponent ] } ) export class AppModule { } Adding Google Maps in Component For creating a Google Map in the template, we