![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
cordova-plugin-firebase
Advanced tools
Readme
Cordova plugin for Google Firebase
This plugin is under development! The primary goal for this plugin is to implement Analytics and FCM for cross platform push notifications. Other parts of the SDK will follow later.
Angular implementation is maintained in the angular-cordova project (source)
Install the plugin by adding it your project's config.xml:
<plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase" />
or by running:
cordova plugin add https://github.com/arnesson/cordova-plugin-firebase.git --save
Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project:
- My Project/
platforms/
plugins/
www/
config.xml
google-services.json <--
GoogleService-Info.plist <--
...
See https://support.google.com/firebase/answer/7015592 for details how to download the files from firebase.
Whenever cordova prepare is triggered the configuration files are copied to the right place in the ios and android app.
Get the device id (token):
window.FirebasePlugin.getInstanceId(function(token) {
// save this server-side and use it to push notifications to this device
console.log(token);
}, function(error) {
console.error(error);
});
Grant permission to recieve push notifications (will trigger prompt):
window.FirebasePlugin.grantPermission();
Subscribe to a topic:
window.FirebasePlugin.subscribe("example");
Unsubscribe from a topic:
window.FirebasePlugin.unsubscribe("example");
Log an event using Analytics:
window.FirebasePlugin.logEvent("pageLoad", "Dashboard");
Fetch Remote Config parameter values for your app:
window.FirebasePlugin.fetch();
// or, specify the cacheExpirationSeconds
window.FirebasePlugin.fetch(600);
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);
});
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);
});
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])
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])
bytes.array;
}, function(error) {
console.error(error);
});
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);
});
Change the settings for the FirebaseRemoteConfig object's operations:
var settings = {
developerModeEnabled: true
}
window.FirebasePlugin.setConfigSettings(settings);
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");
FAQs
Cordova plugin for Google Firebase
The npm package cordova-plugin-firebase receives a total of 267 weekly downloads. As such, cordova-plugin-firebase popularity was classified as not popular.
We found that cordova-plugin-firebase demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.