npm i --save @res0/ns8-facebook
- Version: 2.1.3
- GitHub: https://github.com/NativeScript/plugins
- NPM: https://www.npmjs.com/package/%40res0%2Fns8-facebook
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
@nativescript/facebook
npm install @nativescript/facebook
Prerequisites
Android
Before you can run the project, follow the Getting Started Guide for Facebook Android SDK to set up a Facebook app. You can skip the build.gradle changes since that's taken care of by the rnpm link step above, but make sure you follow the rest of the steps such as updating strings.xml
and AndroidManifest.xml
.
iOS
Follow step 3 in the Getting Started Guide for Facebook SDK for iOS.
Usage
You can also use the Login Manager with custom UI to perform Login.
import { LoginManager, AccessToken } from '@nativescript/facebook';
LoginManager.init() // call init early in the app lifecycle e.g main.ts/app.ts
try {
const result = await LoginManager.logInWithPermissions(['public_profile']); // LoginResult
const accessToken = AccessToken.currentAccessToken();
} catch (e) {}
LoginManager.logOut(); // Whenever you're done
License
Apache License Version 2.0