@res0/ns8-facebook
v2.1.3
Published
Facebook for your NativeScript applications
Downloads
3
Maintainers
Readme
@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