简体   繁体   English

通过Web从Intent打开Android日历(Chrome)

[英]Open Android Calendar with Intent from Web (Chrome)

You can open Android apps from within Chrome using HTML links . 您可以使用HTML链接从Chrome中打开Android应用

And I know that an intent from within an Android app to open the calendar is content://com.android.calendar/time ( How to use Calendar Intent? ) 而且我知道从Android应用程序中打开日历的意图content://com.android.calendar/time如何使用日历意图?

Now I want to create a HTML link to open the calendar app from within Chrome. 现在,我想创建一个HTML链接以从Chrome中打开日历应用。 Note, this is a scenario where my app is not installed on the Android device. 请注意,在这种情况下, 我的应用程序未安装在Android设备上。 So I cannot create App intents to redirect to the calendar app. 因此,我无法创建应用意图来重定向到日历应用。

I imagine something like this: 我想象这样的事情:

intent://time#Intent;scheme=content;package=com.android.calendar;end

Unfortunately that link doesn't work — it opens a "Not found" page in the Play Store. 不幸的是,该链接不起作用-它将在Play商店中打开“未找到”页面。

What am I missing? 我想念什么? What would the link need to look like? 链接需要什么样?

Source: Calendar App Manifest.xml 来源: Calendar App Manifest.xml

Possible duplicate: open android calendar with html link . 可能重复: 使用html链接打开android日历

To open an activity from a browser the activity's intent-filter must have the BROWSABLE category. 要从浏览器打开活动,活动的意图过滤器必须具有BROWSABLE类别。

If you look at the AndroidManifest.xml from the Google Calendar app you referenced, there exists only one such activity: com.android.calendar/.GoogleCalendarUriIntentFilter . 如果您从引用的Google日历应用中查看AndroidManifest.xml ,则仅存在一个这样的活动: com.android.calendar/.GoogleCalendarUriIntentFilter This activity accepts URLs to calendar events, including URLs that start with https://www.google.com/calendar/event . 此活动接受日历事件的URL,包括以https://www.google.com/calendar/event开头的URL。

If you don't mind the short warning message that the opened event doesn't exist, you could use this link to open the Calendar app from a browser. 如果您不介意已打开的事件不存在的简短警告消息,则可以使用此链接从浏览器打开“日历”应用程序。 If you prefer an intent link, you could also use intent://www.google.com/calendar/event#Intent;scheme=https;package=com.google.android.calendar;end , but unfortunately you won't be able to start com.android.calendar/.AllInOneActivity , the activity listening for content://... URLs, directly from the browser. 如果您希望使用意图链接,也可以使用intent://www.google.com/calendar/event#Intent;scheme=https;package=com.google.android.calendar;end ,但不幸的是,您不会能够直接从浏览器启动com.android.calendar/.AllInOneActivity ,监听content://... URL的活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM