Dan Page
Dan Page

Reputation: 95

Create React App PWA Push Notifications on Android

Is it possible to send a PWA installed on an Android phone push notifications with CRA?

Constraints:

  1. Create React App
  2. Registered service worker to turn into PWA
  3. PWA Installed on Android as a "fake/PWA" native app

Upvotes: 0

Views: 4110

Answers (1)

WMordy
WMordy

Reputation: 21

You can send notifications to your service worker using push notification API . You can send notifications to a react app using the service worker mechanism. You can get a service worker pre-configured by generating the code with Create React App. More details about CRA service-worker here.

 `npx create-react-app my-app --template cra-template-pwa`. 

In order to add push notifications you will need to implement a listener inside your business logic that will trigger the notification (a processing result, a button push... etc) then you can trigger the notification as mentioned here.

check the documentation : https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications

Upvotes: 2

Related Questions