Required Cordova plugins
cordova-plugin-app-update
cordova-plugin-appversion
on mounted Android app called updateAndroidApp()
// [START initialize_firebase_in_sw] | |
// Give the service worker access to Firebase Messaging. | |
// Note that you can only use Firebase Messaging here, other Firebase libraries | |
// are not available in the service worker. | |
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js'); | |
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js'); | |
// Initialize the Firebase app in the service worker by passing in the | |
// messagingSenderId. | |
firebase.initializeApp({ |
const algorithm = 'aes-256-ctr' | |
const secretKey = '654sd656s5ds5d4sd4s5d4sd' | |
function encrypt(string) { | |
const iv = crypto.randomBytes(16) | |
const cipher = crypto.createCipheriv(algorithm, secretKey, iv) | |
const encrypted = Buffer.concat([cipher.update(string), cipher.final()]) |
// | Code | Constant | Reason Phrase | | |
// | ---- | ------------------------------- | ------------------------------- | | |
// | 100 | CONTINUE | Continue | | |
// | 101 | SWITCHING_PROTOCOLS | Switching Protocols | | |
// | 102 | PROCESSING | Processing | | |
// | 200 | OK | OK | | |
// | 201 | CREATED | Created | | |
// | 202 | ACCEPTED | Accepted | | |
// | 203 | NON_AUTHORITATIVE_INFORMATION | Non Authoritative Information | | |
// | 204 | NO_CONTENT | No Content | |