Issues with Linking from WebBrowser in Standalone app

No, you don’t need to update to SDK 20. Just run exp build:ios again.

It works. It’s great! Thanks a lot, Expo team!

I’m having problems with Android and linking in my standalone app. Whenever I redirect to my scheme:// it just opens the app, and doesn’t invoke the Linking handler. I’ve configured branch for my app and updated to sdk20 at the same time, so I’m not sure which part broke it, but it has been working fine for months before.

any progress?
because my android standalone app with sdk 20.0.0 still have issue, it cannot open by use myapp://.
but when i display: Contansts.linkUri, i got myapp://

I’m also having the same problem - only with iOS standalone app deployed with TestFlight. On Android it works fine.
I’m on SDK 21.0.0.
Is there any workaround ? At the moment my app is unusable because users can’t log in!

Aha, I figured the problem! Make sure you use myapp://+ - the “+” being the key

2 Likes

Thank you! Had an issue where opening the app through myapp:// scheme resulted in “could not load experience” if app was already open. But myapp://+ works.

1 Like

Hi guys, I have here:

  • Expo SDK 25
  • app.json deep linking scheme defined
  • Android standalone APK
  • Linking hooks (getInitialUrl and addEventListener)

Constants.linkingUri is https://exp.host:443/@myuser/myapp
Literally struggling here to get Constants.linkingUri to give me myapp://
Another thing - App properties Open by default → Supported links is empty …
Is there any way to have http(s) scheme defined instead of myapp://?

I did everything by the book. What am I doing wrong??? Should I start thinking about detaching?
Thanks.

Update: just tried with a freshly generated empty Expo app. I see my scheme value returned correctly now.
Supported links is still empty though… :frowning:

Another update: I managed to open myapp:// links in standalone, but from another Expo app with Linking.openUrll(), not from browser.
Params get passed correctly when my standalone app was not open, but when it’s already open and foregrounded I get the https://exp.host:443/@myuser/myapp as data …
My lifecycle hook methods are:

import React from 'react';
import { StyleSheet, Text, View, Linking } from 'react-native';
import { Constants } from 'expo';
import qs from 'qs';

export default class App extends React.Component {
  state = {
    url: null,
    data: null
  };
  componentWillMount() {
    Linking.getInitialURL().then(url => this._handleUrl(url));
    Linking.addEventListener('url', this._handleUrl);
  }
  componentWillUnmount() {
    Linking.removeEventListener('url', this._handleUrl);
  }

  _handleUrl = url => {
    this.setState({ url });
    let queryString = url.replace(Constants.linkingUri, '');
    if (queryString) {
      let data = qs.parse(queryString);
      this.setState({ data });
      // alert(`Linked to app with data: ${JSON.stringify(data)}`);
    }
  };

  render() {
    return (
      <View style={styles.container}>
        <Text>Constants.linkingUri: {Constants.linkingUri}</Text>
        <Text>url passed: {Constants.linkingUri}</Text>
        <Text>data: {JSON.stringify(this.state.data)}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center'
  }
});

What am I doing wrong? Should I listen to AppState changes?

This topic was automatically closed after 7 days. New replies are no longer allowed.