我正在尝试了解 Intent URL's
在 android 中是如何工作的。我知道我可以隐式调用在 AndroidManifest
文件中设置了 intent-filter 的 Activity 。但据我所知,我们可以调用在 AndroidManifest
中没有设置 intent-filter
的应用程序 Activity 。我尝试了一些案例,但无法实现。我编写了一个包含一些 Activity 的简单应用程序(没有 intent-filter
),但我无法使用 Intent URL 运行它们。而且我在互联网(和 stackoverflow
)中找不到任何关于 explicit intent url
的有用示例。
因此,如果有人可以为使用 intent url 的显式 Activity 调用
提供一个简单的示例或一个简短的解释,我将不胜感激。
问候,
穆罕默德
最佳答案
这个答案有点晚了,但为了将来引用,我认为 Intent Url 你的意思是你的 Intent 的 Uri。
很容易找到 Uri
任何 Intent (显式或隐式)的格式只需声明一个 Intent
在 java 中使用这些参数对象,然后调用 toUri
为您提供该 Intent 的字符串格式的方法。然后,您可以在您的网页中使用它来与您的应用进行通信。
Intent intent = new Intent(this, SomeActivity.class);
String intentUri = intent.toUri(0);
关于Android:使用 Intent Url 方案显式调用 Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39540111/