Yes
Yes
react-native -v: 2.0.1node -v: 8.4.0npm -v: 4.6.1Then, specify:
(Write your steps here:)
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="www.mydomain.com"
android:pathPrefix="/" />
<data android:scheme="https"
android:host="www.mydomain.com" />
</intent-filter>
android:launchMode="singleTask"componentDidMount() {
Linking.getInitialURL().then((url) => {
console.log('Inside of the function is: ' + url);
this._handleOpenURL(url);
}).catch(err => console.error('An error occurred', err));
}
url variable populated with respective Url application was loaded with
Url is null
Experiencing this too with expo. Linking.getInitialURL works for apps created with react-native init though.
Duplicate of #15961 ?
@Minishlink , not really (similar yes, but not a duplicate). My issue has nothing similar to closing application with back button. For me it just never works at all. Regardless of the way app was killed or never started since installation...
I'm experiencing the same thing since updating from RN 0.46.4 to 0.48.4, it used to work fine before that.
Note: I'm using wix/react-native-navigation
Same issue
Solved it! I'll explain what the problem for us was, if anyone is facing the same issue as we did.
We had a custom activity called "SplashActivity" where we had added the
<intent-filter>
<action android:name="android.intent.action.VIEW" />
...
In our SplashActivity.java we started the MainActivity like this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
For RN to pick up the url from getInitialURL(), we need to pass the data and action to our MainActivity. So basically we just passed the required information to our MainActivity (in SplashActivity.java):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri data = null;
String action = null;
Intent currentIntent = getIntent();
if (currentIntent != null) {
Uri intentData = currentIntent.getData();
if (intentData != null) {
data = intentData;
}
// Get action as well.
action = currentIntent.getAction();
}
Intent intent = new Intent(this, MainActivity.class);
// Pass data and action (if available).
if (data != null) {
intent.setData(data);
}
if (action != null) {
intent.setAction(action);
}
startActivity(intent);
finish();
}
(don't forget to import android.content.Intent; and import android.net.Uri;)
This solved it for us.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.
I am getting null value too but on iOS.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
Same issue