How to use the React Navigation Deep linking in Android - react-native

I succeded to add the Deep Linking feature on my React Native app
https://reactnavigation.org/docs/en/deep-linking.html#docsNav
The problem is when I send the email to Android users.
On iOS:
they receive an email,
copy the link appname://user/david
Paste it to Safari
I have the alert prompt Open the app 👍
On Android:
they receive an email,
copy the link appname://appname/user/david
Paste it to Chrome
Chrome is doing a search on Google and don't ask to open the app 😭
PS: If I use my terminal with
adb shell am start -W -a android.intent.action.VIEW -d 'appname://appname/user/david' com.company.appname I have no problem.
The thing is the Quality Assurance Team can't test it in real-life flow

Related

How can I install a React Native app without releasing it to any store?

I wanna be able to use my app on my iPhone or my Android phone without the need of releasing it to App Store or Google Play Store.
or just use EXPO tools if you are open to using expo development environment for react native
If your project is based on React-Native-CLI and your development environment is all set-up then just run command 'react-native run-android' in the terminal. It will generate a debug apk file which you can be found in the directory:
android > app > build > outputs > apk > debug > app-debug.apk
You can directly install this debug apk in your android phone by connecting the device in the debugging mode and run the above command!
In Xcode, add your Apple ID to Accounts preferences, described in
Adding Your Apple ID Account in Xcode.
In the project navigator, select the project and your target to
display the project editor.
Click General and choose your name from the Team pop-up menu.
Connect the device to your Mac and choose your device from the Scheme
toolbar menu.
Below the Team pop-up menu, click Fix Issue.
Xcode creates a free provisioning profile for you and the warning text
under the Team pop-up menu disappears.
Click the Run button.
Xcode installs the app on the device before launching the app.
Test iOS app on device without apple developer program or jailbreak
For IOS you must have a developer account firstly. And then, you can send your app to itunesconnect and get the app from testflight. Or You can run your ios app on device by using cable. But you dont run your app in developer mode.
For android you just need get the apk from android studio. But some steps there are. Follow this steps for get the apk.
How can I generate an apk that can run without server with react-native?
You can Side load your react native app in iPhone or iPad using Xcode
Open your_projectname.xcworkspace from ios folder in Xcode
XCode - Choose your destination device simulator or device from
Product -> Destination -> Select the device
Create a Temporary provision profile From project Target -> Signing
& Capabilities (Required only for physical device, for simulator don't
require this)
Build and Run your project
React Native's official site has a guide on how to install your app without releasing it.
The tl;dr is as follows:
For ios:
cd AwesomeProject
react-native run-ios
For android:
cd AwesomeProject
react-native run-android

React Native application deployment

I have already developed a React native application on my mac book, this is myfirst application. I want to deploy it to iPhone so that I can test it. I don't want to put it on appstore yet. I am not sure how to compile the application and get it ready to put it on iPhone. I tried this web site
https://www.diawi.com/, but not sure which .ipa or a.pk file, I need to upload. I can also try using expo, but not sure how to use it. Can anyone give me step by step instruction on how to upload this application on iPhone.
any help will be greatly appreciated.
For iPhone
For react-native-init you will probably need Apple developer account to test your app on your phone
Since you are using react-native-init, You should checkout this article by Facebook
https://facebook.github.io/react-native/docs/running-on-device
In the second point, it says Register for an Apple developer account if you don't have one yet
For create-react-native-app you need to do following
Download expo client from App store
Scan the QR code expo generate when you run your app using terminal (npm run start in terminal )
Note: Both Laptop and your phone should be on the same network
According to this thread, You can't use expo with react-native-init but alternatively you can create an expo project using create-react-native-app and then copy, paste files from your init project
For Android
For running your App on Android, You can directly generate/build an apk, send it to your device and just open it to see how it works (In Android you don't need a console or developer account to run your app)
Again, Open this link https://facebook.github.io/react-native/docs/running-on-device
And click on Android Tab to see how you can generate an Apk

React Native Android Run

I am just starting with react native. I created my first app using React Native CLI. It was created without any errors. When I am trying to react-native run-android It ends up with this error as shown.
1) Run command " adb devices "
It will let you know if any device is connected or not
2) Try running by setting the Environment variable and proxy commands.
Follow this link: http://facebook.github.io/react-native/releases/0.38/docs/getting-started.html#content
first Start the android emulator.
From your react native folder run:
cd android && gradlew clean
THEN
cd .. && react-native run-android
Make sure you have your device connected to your computer, you can check that by running:
adb devices
if it's not connected, in your phone go to: settings > Developer Options > (enable) USB debugging.
Else if you want to run it from an emulator you will need to either install Genymotion, or AndroidStudio.
1) Run command adb devices to list all connected devices.
2) Then run command emulator #YOUR_DEVICE_NAME.
3) If adb devices will not show any devices then follow this link
http://facebook.github.io/react-native/releases/0.38/docs/getting-started.html#content
Have an android phone attached to your computer via USB cable and enable USB Debugging in the developer options. To get to the developer options open your About Phone and tap the version number several times.
Once it is in USB Debugging mode, run adb devices and a prompt will show up on your phone. Accept it and you should be good to go.
Another problem I had was I needed to path my SDK location, if you run into that then this will help: React Native android build failed. SDK location not found

test run react native app on iphone

I've signed developer account in xcode.
I connected iphone to mac.
I pressed cmd+b and it show built successful
Then what? How to make the app appear on iphone?
You can always go the route of creating a dev server that is only accessed through your WiFi.
See the following:
https://facebook.github.io/react-native/docs/running-on-device.html
When you connect your device then xcode checks if it's version matches with the device and if it matches then you just need to run the application from xcode by clicking the play button or CTRL+b. Then npm package runs through terminal and finally if the build is successful, the application automatically start running on your device.
Please have a look at the documentation: https://reactnative.dev/docs/running-on-device
If you followed the steps on the React Native website, you will be able to do the following commands on the command line
first, cd to your project directory like this:
cd MyApp
then, once you are in the same directory as your app, start the app with the following command,:
react-native run-ios
This should do it, if not, it will tell you what you are missing.
UPDATE:
I didn't realize it was specific to a real device, in that case, just press the Play button on the top left, pressing Cmd + B just builds the app, press Cmd + R to run.

How to redirect an URL to react native app

How to open a react-native app from an url in safari (iOS) or from other app?
Example (it is android):
I tried this way http://facebook.github.io/react-native/releases/0.38/docs/linking.html
But it is only for opening url from app in safari.
The feature you're trying to implement is called 'deep linking' and this article explains in detail how it should be done with react native for both ios and android platforms.
For Android Virtual Device you should execute the following command from a terminal:
adb shell am start -a android.intent.action.VIEW -d "<app scheme>://<some>/<path>" com.<app name>
This article explains how to implement deep linking for React Native applications: Deep Linking with React Native