1.1.1 • Published 4 years ago
react-native-facebook-app-link v1.1.1
react-native-facebook-app-link
Easily fetch facebook deferred app link url and handle it without native implementation.
Inspired by Maftalion.
Installation
yarn add react-native-fbsdk react-native-facebook-app-link
cd ios
pod install
In android/build.gradle
, check facebookSdkVersion
// android/build.gradle
buildscript {
ext {
// facebookSdkVersion should be in 7.0.0 ~ 8.0.0
facebookSdkVersion = "7.1.0"
...
Upgrading from old version of fbsdk, you might want to call pod update for iOS.
pod update FBSDKShareKit FBSDKLoginKit FBSDKCoreKit
Usage
import FacebookAppLink from 'react-native-facebook-app-link';
const url = await FacebookAppLink.fetchUrl();
if(url){
// do whatever with the url.
}
If you follow the Facebook GDPR Compliance Best Practices and set the AutoInitEnabled
flag to false
, initialize the SDK before fetchUrl
:
import FacebookAppLink from 'react-native-facebook-app-link';
// get user consent
FacebookAppLink.initializeSDK();
const url = await FacebookAppLink.fetchUrl();
if(url){
// do whatever with the url.
}
API
name | description |
---|---|
fetchUrl | Fetch deferred app link from Facebook |
initializeSDK | Initialize the Facebook SDK (For FB GDPR Compliance Best Practices) |
Reference
Maftalion's answer in react-native-fbsdk issue #648
FACEBOOK for developers - Add Deep Links to Your App Ad - Step2