无法启动什么 3 字意图

Cannot launch what 3 words intent

我正在尝试使用此处的文档打开三词地址应用程序

https://developer.what3words.com/tutorial/mobile-linking-to-the-what3words-app/

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("w3w://show?threewords=daring.lion.race"));
startActivityForResult(intent, INTENT_CODE);

但我一直遇到这个问题

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=w3w://show?threewords=daring.lion.race}

我在我的设备上 google 播放并在设备上安装了 what3words 应用程序。

试试这样打开应用程序:

Intent intent = packageManager.getLaunchIntentForPackage("{w3w package name}");
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("w3w://show?threewords=daring.lion.race"));
startActivity(intent);

要获取包名,请在 adb 中查找:

adb shell pm list packages