npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-firebase-peoples-systems

v0.1.21

Published

Cordova plugin for Google Firebase modified using fork by Julien Fougere (https://github.com/jfougere). Pull request can be found at https://github.com/arnesson/cordova-plugin-firebase/pull/202

Downloads

11

Readme

cordova-plugin-firebase-peoples-systems

This repository is a fork of https://github.com/arnesson/cordova-plugin-firebase by Julien Fougere

The following changes have been done:

  • Allow reception of notification title & body on Android inside the javascript callback (foreground only)

    Title & body are pushed inside the data as:

    data.title
    data.body
  • Avoid wrong callback of notification upon application boot or resume (Fix since OnNotificationOpenReceiver does not seems to be called)

  • Added tap=true when notification is tapped (Fix since OnNotificationOpenReceiver does not seems to be called) (Resuming case and cold start)

  • Included this PR in order to have hasPermission method working on Android

This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).

Methods

getToken

Get the device token (id):

window.FirebasePlugin.getToken(function(token) {
    // save this server-side and use it to push notifications to this device
    console.log(token);
}, function(error) {
    console.error(error);
});

Note that token will be null if it has not been established yet

onTokenRefresh

Register for token changes:

window.FirebasePlugin.onTokenRefresh(function(token) {
    // save this server-side and use it to push notifications to this device
    console.log(token);
}, function(error) {
    console.error(error);
});

This is the best way to get a valid token for the device as soon as the token is established

onNotificationOpen

Register notification callback:

window.FirebasePlugin.onNotificationOpen(function(notification) {
    console.log(notification);
}, function(error) {
    console.error(error);
});

Notification flow:

  1. App is in foreground:
    1. User receives the notification data in the JavaScript callback without any notification on the device itself (this is the normal behaviour of push notifications, it is up to you, the developer, to notify the user)
  2. App is in background:
    1. User receives the notification message in its device notification bar
    2. User taps the notification and the app opens
    3. User receives the notification data in the JavaScript callback

Notification icon on Android:

The plugin will look for and use notification_icon in drawable resources if it exists, otherwise the default app icon will is used.

grantPermission (iOS only)

Grant permission to recieve push notifications (will trigger prompt):

window.FirebasePlugin.grantPermission();

setBadgeNumber

Set a number on the icon badge:

window.FirebasePlugin.setBadgeNumber(3);

Set 0 to clear the badge

window.FirebasePlugin.setBadgeNumber(0);

getBadgeNumber

Get icon badge number:

window.FirebasePlugin.getBadgeNumber(function(n) {
    console.log(n);
});

subscribe

Subscribe to a topic:

window.FirebasePlugin.subscribe("example");

unsubscribe

Unsubscribe from a topic:

window.FirebasePlugin.unsubscribe("example");

logEvent

Log an event using Analytics:

window.FirebasePlugin.logEvent("page_view", {page: "dashboard"});

setUserId

Set a user id for use in Analytics:

window.FirebasePlugin.setUserId("user_id");

setUserProperty

Set a user property for use in Analytics:

window.FirebasePlugin.setUserProperty("name", "value");

fetch (Android only)

Fetch Remote Config parameter values for your app:

window.FirebasePlugin.fetch();
// or, specify the cacheExpirationSeconds
window.FirebasePlugin.fetch(600);

activateFetched (Android only)

Activate the Remote Config fetched config:

window.FirebasePlugin.activateFetched(function(activated) {
    // activated will be true if there was a fetched config activated,
    // or false if no fetched config was found, or the fetched config was already activated.
    console.log(activated);
}, function(error) {
    console.error(error);
});

getValue (Android only)

Retrieve a Remote Config value:

window.FirebasePlugin.getValue("key", function(value) {
    console.log(value);
}, function(error) {
    console.error(error);
});
// or, specify a namespace for the config value
window.FirebasePlugin.getValue("key", "namespace", function(value) {
    console.log(value);
}, function(error) {
    console.error(error);
});

getByteArray (Android only)

NOTE: byte array is only available for SDK 19+ Retrieve a Remote Config byte array:

window.FirebasePlugin.getByteArray("key", function(bytes) {
    // a Base64 encoded string that represents the value for "key"
    console.log(bytes.base64);
    // a numeric array containing the values of the byte array (i.e. [0xFF, 0x00])
    console.log(bytes.array);
}, function(error) {
    console.error(error);
});
// or, specify a namespace for the byte array
window.FirebasePlugin.getByteArray("key", "namespace", function(bytes) {
    // a Base64 encoded string that represents the value for "key"
    console.log(bytes.base64);
    // a numeric array containing the values of the byte array (i.e. [0xFF, 0x00])
    console.log(bytes.array);
}, function(error) {
    console.error(error);
});

getInfo (Android only)

Get the current state of the FirebaseRemoteConfig singleton object:

window.FirebasePlugin.getInfo(function(info) {
    // the status of the developer mode setting (true/false)
    console.log(info.configSettings.developerModeEnabled);
    // the timestamp (milliseconds since epoch) of the last successful fetch
    console.log(info.fetchTimeMillis);
    // the status of the most recent fetch attempt (int)
    console.log(info.lastFetchStatus);
}, function(error) {
    console.error(error);
});

setConfigSettings (Android only)

Change the settings for the FirebaseRemoteConfig object's operations:

var settings = {
    developerModeEnabled: true
}
window.FirebasePlugin.setConfigSettings(settings);

setDefaults (Android only)

Set defaults in the Remote Config:

// define defaults
var defaults = {
    // map property name to value in Remote Config defaults
    mLong: 1000,
    mString: 'hello world',
    mDouble: 3.14,
    mBoolean: true,
    // map "mBase64" to a Remote Config byte array represented by a Base64 string
    // Note: the Base64 string is in an array in order to differentiate from a string config value
    mBase64: ["SGVsbG8gV29ybGQ="],
    // map "mBytes" to a Remote Config byte array represented by a numeric array
    mBytes: [0xFF, 0x00]
}
// set defaults
window.FirebasePlugin.setDefaults(defaults);
// or, specify a namespace
window.FirebasePlugin.setDefaults(defaults, "namespace");