Expo linking fb post url scheme - react-native

Is there a working url scheme for posting on Facebook app (not opening in browser) from Expo app? I've read all about deep linking on Expo documentation, but whatever I type for fb:// it only opens the app and does nothing, and I need to post some text. I've used expo-linking to share an image or text in Facebook Messenger and other apps (Sms, Twitter, WhatsApp) and it's working:
const openMessenger = async() => {
try{
await Linking.openURL(`fb-messenger://share/?link=${myLink}`);
}
catch(error){
console.log(error);
}
}

Related

react native supabase facebook login redirect callback site url

I am trying to login with facebook using Supabase on ios emulator. After logging in with Facebook, it redirects me back to localhost. I don't know exactly what to do on this side. Can you help me? I'm still very new.
const onHandleLogin = async () => {
const {data, error} = await supabase.auth.signInWithOAuth({
provider: 'facebook',
});
if (error) {
return;
}
if (data.url) {
const supported = await Linking.canOpenURL(data.url);
if (supported) {
await Linking.openURL(data.url);
}
}
};
After the login process, it still stays on the localhost address on the browser. My purpose is to send it to the application and get token information via the url, but I have no idea how.
I think I need to make changes here but I don't know what to write in the site url because it is a mobile application.
Thanks for your support and replies.
I tried to login with facebook using supabase, but after logging in, it keeps me in safari and gives token information on localhost. I want to direct the application after the login process and get the token information.
You will need to create a deep link for your React Native app: https://reactnative.dev/docs/linking and then set this as your redirect URL. Here a similar example with Flutter: https://supabase.com/docs/guides/getting-started/tutorials/with-flutter#setup-deep-links

Is it possible to pass referer URL in the request header to React Native App using Deep Linking?

My React Native app has a website version. When an user click a link to our website, it will open my App using Deep links. Now I want to send some data from that url to my app, specifically the referer field in request header (for tracking tool search, like google.com, etc. ). I already have this piece of code in my app :
useEffect(() => {
const subscription = Linking.addEventListener('url', navigateScreen);
//navigateScreen is a function to navigate to screen of my App depending on url
return () => {
if (subscription) {
subscription?.remove();
}
};
}, [navigateScreen]);
So my question is can I have my App receive the request header of url or only the url itself ? If can how can I achieve it ?

How to open URL with scheme intent:// on react native

I have a react native mobile app with a webview. In the webview I added the facebook messenger chat plugin so my users can easily contact us if they need help.
if you ran the website through a mobile browser it works. It redirects you to the official messenger.
But when you ran it through react native webview somehow it says No activity found to handle Intent
here is my code on how i handle the opening of the intent
onShouldStartLoadWithRequest={(request) => {
let url = request.url
if(url.startsWith('intent:')){
Linking.openURL(url).catch(er => {
console.log(er)
alert("Failed to open URL")
});
return false
}else{
return true
}
}}
this will console log
[Error: Could not open URL
'intent://user/107571147455693/?intent_trigger=mme&nav=discover&source=customer_chat_plugin&source_id=1507329&metadata=%7B%22referer_uri%22%3A%22https%3A%5C%2F%5C%2Ffusiontechph.com%5C%2Ff9fe1863270a2%22%7D#Intent;scheme=fb-messenger;package=com.facebook.orca;end':
No Activity found to handle Intent { act=android.intent.action.VIEW
dat=intent://user/107571147455693/?intent_trigger=mme&nav=discover&source=customer_chat_plugin&source_id=1507329&metadata={"referer_uri":"https://fusiontechph.com/f9fe1863270a2"}
flg=0x10000000 }]
I have a workaround that worked for me. Facebook messenger provides a link to your facebook page message. So you can just open that link directly without using the intent scheme of facebook here is the final code
onShouldStartLoadWithRequest={(request) => {
let url = request.url
if(url.startsWith('intent:')){
Linking.openURL('https://m.me/mluc.jsites').catch(e=>{
console.log(e) })
return false
}else{
return true
}
}}

Open Whatsapp from React Native app with Expo

Currently trying to open whatsapp from my React Native app with Expo. I have the code below:
let url = 'whatsapp://app';
Linking.openURL(url).then((data) => {
console.log('WhatsApp Opened');
}).catch((err) => {
console.log(err);
alert('Make sure Whatsapp installed on your device');
});
The error I get is this:
Error: Could not open URL 'whatsapp://app': No Activity found to handle Intent { act=android.intent.action.VIEW dat=whatsapp://app flg=0x10000000 }
However when I change the url to send, it opens whatsapp fine?
whatsapp://send?phone=3464478983
I am trying to only open whatsapp without a send param

React Native: How to open a Bitcoin URL?

How do you open a Bitcoin URL in a react native app? I am using React Native Linking to detect if there are any apps on the phone that can open a Bitcoin URL formatted according to BIP21. I have 3 apps installed that should handle it:
1) Coinbase
2) Breadwallet
3) Blockchain.info wallet
But it's not opening. Here's the code:
async _openWallet() {
const coinURL = 'bitcoin:15bMc6sQTiQ5jSqoRX3JzatAbQqJaffqup';
try {
const supported = await Linking.canOpenURL(coinURL);
if (supported) {
Linking.openURL(coinURL);
} else {
console.log('Could not find a compatible wallet on this device.');
}
} catch (error) {
console.log(error);
}
}
supported keeps returning false, which causes "Could not find a compatible wallet..." to execute. The weird thing is if I click on a Bitcoin URL on any random website via the Chrome / Safari browser, I get a popup that asks me if I want to open the URL in one of the above apps. So only URLs on websites are opening, but not URLs from inside react native code.
Any ideas?
Looks like every URI scheme you want to use at runtime must be defined up-front in Info.plist. Found the answer here: React Native: Linking API not discovering Uber app