Skip to content

Instantly share code, notes, and snippets.

View devzarghami's full-sized avatar
💫
Women Life Freedom

dev zarghami ./ devzarghami

💫
Women Life Freedom
  • mashhad iran
View GitHub Profile
@devzarghami
devzarghami / firebase-messaging-sw.js
Created October 29, 2023 16:17 — forked from loicginoux/firebase-messaging-sw.js
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [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 |

Android & Pwa AppUpdate

cordova android AppUpdate

Required Cordova plugins

cordova-plugin-app-update

cordova-plugin-appversion

on mounted Android app called updateAndroidApp()

ENOSPC: System limit for number of file watchers

sIncreasing the amount of inotify watchers

  • If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@devzarghami
devzarghami / bashrc.md
Last active May 28, 2020 06:40
for set ANDROID_HOME , JAVA_HOME ,ANDROID_SDK_ROOT in ubuntu for cordova

set this values in .bashrc file in ubuntu for

ANDROID_HOME , JAVA_HOME ,ANDROID_SDK_ROOT
export ANDROID_HOME="/home/nvsh103/Android/Sdk"
ANDROID_HOME=/home/nvsh103/Android/Sdk


PATH=$PATH:$ANDROID_HOME/tools
PATH=$PATH:$ANDROID_HOME/platform-tools
@devzarghami
devzarghami / cordova config.md
Last active May 28, 2020 06:58
all config in cordova config file

Cordova Config For Build App

  • change app icon
  • open installed app from external link
  • security config to send xhhtp request in android < 9

Open Installed App By External Link - DeepLink