You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo技术咨询:分享网页链接时我的应用未显示在分享列表中

Hey Chandra, let's get your Expo Android app showing up in the browser's share menu when sharing links like Google's URL. Here's a step-by-step breakdown to fix this:

Step 1: Add Intent Filters to Your app.json

Android uses intent filters to recognize which apps can handle specific types of shared content. You need to configure this in your Expo project's app.json to tell the system your app accepts web links shared as plain text.

Add this snippet inside the expo.android section:

{
  "expo": {
    "android": {
      "intentFilters": [
        {
          "action": "android.intent.action.SEND",
          "data": [
            {
              "mimeType": "text/plain"
            }
          ],
          "category": [
            "android.intent.category.DEFAULT"
          ]
        }
      ]
    }
  }
}

This filter tells Android your app can receive text/plain content—most web links are shared in this format, so this will cover your use case.

Even if your app appears in the share menu, it won't do anything useful unless you process the incoming link. Use Expo's Linking API to capture and handle the shared URL.

Add this code to your main app component:

import { Linking, useEffect } from 'react-native';

export default function App() {
  useEffect(() => {
    // Check for a link when the app first opens
    const checkInitialLink = async () => {
      const url = await Linking.getInitialURL();
      if (url) {
        // Do something with the shared URL—e.g., display it or navigate to a screen
        console.log('Received shared link:', url);
      }
    };

    checkInitialLink();

    // Listen for future share events while the app is running
    const linkSubscription = Linking.addEventListener('url', (event) => {
      console.log('Received shared link:', event.url);
      // Handle the link here
    });

    // Clean up the listener when the component unmounts
    return () => linkSubscription.remove();
  }, []);

  // Rest of your app code...
}
Step 3: Build a Custom Expo Android App

Important: Expo Go doesn't support custom intent filters, so you can't test this with the Expo Go app. You need to create a custom development build or production build using EAS Build.

Run this command to start the build process:

eas build --platform android

Once the build finishes, download and install the APK on your Android device.

Troubleshooting Quick Checks
  • Double-check your app.json syntax: Make sure the intent filter is nested correctly under expo.android—a typo here will break everything.
  • Uninstall old versions: Sometimes cached app data can prevent new intent filters from working. Uninstall any previous versions of your app before installing the new build.
  • Add extra mime types (if needed): If you want to handle other share types, add text/uri-list to the data.mimeType array for more robust link support.

内容的提问来源于stack exchange,提问作者Chandra Bhushan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 23:47:48