admin管理员组

文章数量:1287523

I'm following this tutorial:


but my app doesn't lunched when I type this url at browser:

peopleapp://people/0

my manifest.xml:

<manifest xmlns:android=""
    package="*.*.*"
    xmlns:tools="">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:largeHeap="true"
      android:theme="@style/AppTheme"
      android:supportsRtl="false"
      android:screenOrientation="portrait"
      tools:replace="android:supportsRtl">
      <activity
        android:name=".MainActivity"
        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 android:label="filter_react_native">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="peopleapp" android:host="people" />
        </intent-filter>


      </activity>
      <activity android:name=".facebook.react.devsupport.DevSettingsActivity" />

      <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
          <intent-filter>
          <action android:name=".google.firebase.MESSAGING_EVENT" />
          </intent-filter>
    </service>
    <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
        <intent-filter>
        <action android:name=".google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
    </service>


  <meta-data
    android:name=".google.firebase.messaging.default_notification_channel_id"
    android:value="teamcide"/>


  <meta-data
     android:name=".google.android.geo.API_KEY"
     android:value="AIzaSyDpiU78-****S6Lvllgqo"/>

    </application>

</manifest>

I'm following this tutorial:

https://medium./react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e

but my app doesn't lunched when I type this url at browser:

peopleapp://people/0

my manifest.xml:

<manifest xmlns:android="http://schemas.android./apk/res/android"
    package="*.*.*"
    xmlns:tools="http://schemas.android./tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:largeHeap="true"
      android:theme="@style/AppTheme"
      android:supportsRtl="false"
      android:screenOrientation="portrait"
      tools:replace="android:supportsRtl">
      <activity
        android:name=".MainActivity"
        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 android:label="filter_react_native">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="peopleapp" android:host="people" />
        </intent-filter>


      </activity>
      <activity android:name=".facebook.react.devsupport.DevSettingsActivity" />

      <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
          <intent-filter>
          <action android:name=".google.firebase.MESSAGING_EVENT" />
          </intent-filter>
    </service>
    <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
        <intent-filter>
        <action android:name=".google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
    </service>


  <meta-data
    android:name=".google.firebase.messaging.default_notification_channel_id"
    android:value="teamcide"/>


  <meta-data
     android:name=".google.android.geo.API_KEY"
     android:value="AIzaSyDpiU78-****S6Lvllgqo"/>

    </application>

</manifest>
Share Improve this question edited Mar 10, 2019 at 10:53 S.M_Emamian asked Mar 10, 2019 at 10:04 S.M_EmamianS.M_Emamian 17.4k40 gold badges154 silver badges273 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

There is a small quirk with Android and deep links and that is putting the link in your browser won't work. There are a couple of ways that you can open the link.

Tutorial

In the tutorial it says the following about opening it on an Android device:

That is all we need as far as configuration goes. To test this out, open Android Studio. Open Run -> Edit Configurations and change the launch options to URL, passing in the following url: peopleapp://people/1

App from the Play Store

You can use the following app to open your deep links https://play.google./store/apps/details?id=.manoj.dlt

Create a webpage

You can create a small webpage with your deep link contained inside an href

<a href="peopleapp://people/0">open people 0</a>

And then browse to that page and click your link.

Hii you can use following code to open specific url in react native

const url = 'whatsapp://';
Linking.canOpenURL(url)
.then(supported => {
  if (!supported) {
    console.log('Can\'t handle url: ' + url);
  } else {
    return Linking.openURL(url);
  }
}).catch(err => console.error('An error occurred', err));

Or you can also check this url for more information

本文标签: javascriptHow to open app with an url specific react nativeStack Overflow