React Native 链接到照片应用程序

React Native linking out to photo app

我制作了自己的类似于 android 相机的视频应用程序,当用户单击底角的过去视频缩略图时,我想打开本机照片应用程序。在这两种情况下都称为照片。我知道我需要做这样的事情

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

但我想不通的是 URL 应该是什么?

使用包名"com.google.android.apps.photos"

你的代码看起来像

private final static STRING PHOTOS_PACKAGE_NAME = "com.google.android.apps.photos";
// ...
getPackageManager().getPackageInfo(PHOTOS_PACKAGE_NAME, 0);
Intent intent = getPackageManager().getLaunchIntentForPackage(PHOTOS_PACKAGE_NAME);
if (intent != null) {
    startActivity(intent);
} else {
    // LOG Error and navigate to Play Store?
}