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

backendless-react-native

v0.1.8

Published

Backendless React Native

Downloads

44

Readme

npm version

Patch for using Backendless JS-SDK inside React Native App.

Actually Backendless JS-SDK is totally adapted for working in React Native applications, you can use almost the entire Backendless API, but also there are some features which require Native iOS/Android implementation.

Additional Backendless features:

  • Support Push Notification Templates
  • Device Registration becomes more simpler Backendless.Messaging.registerDevice(['channelName'])
  • Listeners for Push Notifications
    Backendless.Messaging.addPushNotificationListener(callback);
    Backendless.Messaging.removePushNotificationListener(callback);
    Backendless.Messaging.addPushNotificationActionListener(callback);
    Backendless.Messaging.removePushNotificationActionListener(callback);

Install

npm i backendless backendless-react-native -S

Setup Native projects

Usage

Import and init Backendless JS-SDK

import { Platform } from 'react-native';
import Backendless from 'backendless';
import 'backendless-react-native';

const APP_ID = 'YOUR_APP_ID';

const API_KEY = Platform.select({
  ios    : 'YOUR_IOS_API_KEY',
  android: 'YOUR_ANDROID_API_KEY'
});

Backendless.initApp(APP_ID, API_KEY);

Recommended to use corresponding Api Keys for each platform, but you can use any Api Key, for ex: JS_API_KEY or REST_API_KEY

Backendless.initApp(APP_ID, ANY_API_KEY);

Features

Register Device

Backendless.Messaging.registerDevice(['default']).then(onSuccess).catch(onFail);

Unregister Device

Backendless.Messaging.unregisterDevice().then(onSuccess).catch(onFail);

Subscribe on Push Notifications

Backendless.Messaging.addPushNotificationListener(callback)
Backendless.Messaging.removePushNotificationListener(callback)

function callback(notification:Object){
// notification.message => "push message"
// notification.title => "push title"
// notification.subtitle => "push subtitle" 
// notification.sound => null
// notification.badge => 2
// notification.attachmentUrl => "https://backendlessappcontent.com/.../files/banner-4.jpg"
// notification.contentAvailable => 0
// notification.mutableContent => 1
// notification.customHeaders => { myHeaderKey: "myHeaderValue" }
// notification.templateName => "testName"
}

Subscribe on Push Notification Actions


Backendless.Messaging.addPushNotificationActionListener(callback)
Backendless.Messaging.removePushNotificationActionListener(callback)

function callback(action:Object){

// action.id => "action id" 
// action.inlineReply => "some text" 

// action.notification.message => "push message"
// action.notification.title => "push title"
// action.notification.subtitle => "push subtitle" 
// action.notification.sound => null
// action.notification.badge => 2
// action.notification.attachmentUrl => "https://backendlessappcontent.com/.../files/banner-4.jpg"
// action.notification.contentAvailable => 0
// action.notification.mutableContent => 1
// action.notification.customHeaders => { myHeaderKey: "myHeaderValue" }
// action.notification.templateName => "testName"
}
    

Get Initial Notification Action

Backendless.Messaging.getInitialNotificationAction().then(onSuccess).catch(onFail)

function onSuccess(action:Object){
// action.id => "action id" 
// action.inlineReply => "some text" 

// action.notification.message => "push message"
// action.notification.title => "push title"
// action.notification.subtitle => "push subtitle" 
// action.notification.sound => null
// action.notification.badge => 2
// action.notification.attachmentUrl => "https://backendlessappcontent.com/.../files/banner-4.jpg"
// action.notification.contentAvailable => 0
// action.notification.mutableContent => 1
// action.notification.customHeaders => { myHeaderKey: "myHeaderValue" }
// action.notification.templateName => "testName"
}

Get/Set Application Icon Badge Number (for iOS only)

Backendless.Messaging.getAppBadgeNumber().then(onGetSuccess).catch(onFail)

function onGetSuccess(badge:Number){
}

Backendless.Messaging.setAppBadgeNumber(badge:Number).then(onSetSuccess).catch(onFail)

function onSetSuccess(void){
}

Get Delivered Notifications

Backendless.Messaging.getNotifications().then(onSuccess).catch(onFail)

function onSuccess(notifications:Array<Object>){
}

Cancel All Delivered Notifications

Backendless.Messaging.cancelAlldNotifications().then(onSuccess).catch(onFail)

function onSuccess(void){
}

Cancel Delivered Notification

Backendless.Messaging.cancelNotification(notification.id).then(onSuccess).catch(onFail)

function onSuccess(void){
}