This package has been deprecated

Author message:

Read more: https://gist.github.com/brentvatne/9038b16b4f42a21cea40ad5c35fdb74c

expo-firebase-instance-id

2.0.0 • Public • Published

expo-firebase-instance-id

expo-firebase is still in RC and therefore subject to breaking changings. Be sure to run yarn upgrade and cd ios; pod install when upgrading.

expo-firebase-instance-id provides access to the instance ID, and Push Token.

Full documentation

Installation

First, you need to install the package from npm registry.

npm install expo-firebase-instance-id or yarn add expo-firebase-instance-id

iOS

Cocoapods

If you're using Cocoapods, add the dependency to your Podfile:

pod 'EXFirebaseInstanceID', path: '../node_modules/expo-firebase-instance-id/ios'

and run pod install.

Android

  1. Append the following lines to android/settings.gradle:

    include ':expo-firebase-instance-id'
    project(':expo-firebase-instance-id').projectDir = new File(rootProject.projectDir, '../node_modules/expo-firebase-instance-id/android')

    and if not already included

    include ':expo-core'
    project(':expo-core').projectDir = new File(rootProject.projectDir, '../node_modules/expo-core/android')
     
    include ':expo-firebase-app'
    project(':expo-firebase-app').projectDir = new File(rootProject.projectDir, '../node_modules/expo-firebase-app/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:

    api project(':expo-firebase-instance-id')

    and if not already included

    api project(':expo-core')
    api project(':expo-firebase-app')
  3. Include the module in your expo packages: ./android/app/src/main/java/host/exp/exponent/MainActivity.java

    /*
    * At the top of the file.
    * This is automatically imported with Android Studio, but if you are in any other editor you will need to manually import the module.
    */
    import expo.modules.firebase.app.FirebaseAppPackage; // This should be here for all Expo Firebase features. 
    import expo.modules.firebase.instanceid.FirebaseInstanceIDPackage;
     
    // Later in the file... 
     
    @Override
    public List<Package> expoPackages() {
      // Here you can add your own packages. 
      return Arrays.<Package>asList(
        new FirebaseAppPackage(), // This should be here for all Expo Firebase features. 
        new FirebaseInstanceIDPackage() // Include this. 
      );
    }

Usage

import React from 'react';
import { View } from 'react-native';
import firebase from 'expo-firebase-app';
 
// API can be accessed with: firebase.iid();
 
export default class DemoView extends React.Component {
  async componentDidMount() {
    // ... initialize firebase app
 
    const token = await firebase.iid().getToken();
  }
  render() {
    return <View />;
  }
}

Dependents (0)

Package Sidebar

Install

npm i expo-firebase-instance-id

Weekly Downloads

11

Version

2.0.0

License

MIT

Unpacked Size

14.3 kB

Total Files

12

Last publish

Collaborators

  • radoslawkrzemien
  • pkham
  • szdziedzic
  • tsapeta
  • wkozyra
  • ide
  • lukmccall
  • evanbacon