Issue
I want to open New React native App by clicking on Button in which I have used
Linking Concepts in React native
React native Code : Test is the name of the Other App
Linking.openURL('Test://app');
Also following URL for adding Intent in the android.manifest.xml file Andriod Intent
Code : Android.manifestfile.xml
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="com.Test" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="Test" android:host="app" />
</intent-filter>
</activity>
How can I resolve the issue?
Solution
Add this code in your AndroidManifest.xml file parallel to current intent filter
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos” -->
<data android:scheme="app"
android:host="testApp" />
</intent-filter>
and run this command React-native run-android
Add below code to your react-native file.
<Button title="Click me" onPress={ ()=>{ Linking.openURL('app://testApp')}} />
for save the time . You can to both code in same application and same application will be open on button press
i just try this code and its working for me let me know if still facing issue (Y)
Answered By - anil sidhu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.