Code Monkey home page Code Monkey logo

particle-react-native-bridge-example's Introduction

Particle SDK - React Native bridge

A React Native integration for the Particle iOS SDK.

Using this basic app as an example, you should be able to integrate the setup process of Particle-powered products into your own React Native app.

If you aren't familiar with the process of creating native modules, React Native have some useful documentation to get you started.

Prerequisites

You will need node.js, Watchman, the command line interface for React Native, and Xcode installed. Follow the Getting Started guide (Building projects with Native Code) to ensure these are all correctly installed.

Running the sample app

$ git clone https://github.com/pixielabs/particle-react-native-bridge-example.git
$ cd particle-react-native-bridge-example
$ yarn

You'll then need to build and run the app from within Xcode using the generated project workspace.

Using the Particle SDK

Particle Device Setup Library

In this example, we use the Particle Device Setup Library only; this allows you to create a setup wizard inside your app for users to manually configure their Particle devices.

In addition to creating the native modules ParticleSetupBridge.m and ParticleSetupViewController.m (together with their header files) as per the sample app, you'll need to install the Particle library via Cocoapods. Follow the installation instructions in the Particle documentation.

Particle Cloud SDK

For your mobile app to interact directly with internet-connected hardware, you'll need to integrate separately with the Cloud SDK.

For example, if you use your own backend to authenticate your users, you can use the Cloud SDK to inject their session access token and treat them as logged in. Simply add the following code to ParticleSetupBridge.m before setting up the ParticleSetupMainController:

if ([[ParticleCloud sharedInstance] injectSessionAccessToken:accessToken]) {
  NSLog(@"Session is active!");
} else {
  // Do something here to alert the user that their token has expired.
  // They'll need to log in again.
  return;
}

Android integration

Currently, this example app deals with iOS only - but we'd love for it to support Android too. We'd be very happy for any contributors to help flesh this out - simply fork this project, start a feature branch and make a pull request!

particle-react-native-bridge-example's People

Contributors

abigailmcp avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.