从自定义cordova应用程序启动本机应用程序 [英] Launch native apps from custom cordova app
问题描述
我正在使用Cordova(在Intel XDK中)开发一个移动应用程序,它是启动其他应用程序的按钮列表。
I'm developing a mobile app with Cordova (in Intel XDK) which is a list of buttons that launches other apps.
到目前为止,我已经设法启动手机应用程序( href = tel://
),短信( href = sms://
)和浏览器中的Google网站( href = http://google.com
)。
So far I've managed to launch phone app (href="tel://"
), sms (href="sms://
) and google website in browser (href="http://google.com"
).
我已经找到了用于启动应用程序的插件: https://github.com/lampaa/com.lampa.startapp ,但根据提供的指南,我可以使用以下代码(示例)启动应用程序:
I've found a plugin for starting apps: https://github.com/lampaa/com.lampa.startapp but basing on guide provided there I can launch an app with code like this (example) :
navigator.startApp.start([["app.com.name", "app.com.name.Activity"], [{"product_id":"100"}]], ...);
但是我如何找到这些完整的应用程序名称(这些 app.com.name
字符串)?
But how can I find those full app names (these app.com.name
strings) ?
我需要这些应用程序的名称(或打开方式):
I need names for these apps (or way how to open them):
- 视频(Android的默认应用)
- 图片/相机胶卷(用于android),
- 相机,
- WiFi设置,
- 蓝牙设置,
- 具有空白或主页的浏览器窗口。
- Videos (default app for android),
- Pictures / Camera Roll (default app for android),
- Camera,
- WiFi settings,
- Bluetooth settings,
- Browser window with blank or home page opened.
提醒一下:我不不想在这些应用程序和我的应用程序之间同步任何数据-我只想只通过我的应用程序启动它。
Just to remind: I don't want to sync any data between these apps and mine - I just want simply to launch it via my app.
如果您还有其他解决方案-我愿意
If You have other solutions - I'm open for any suggestions.
推荐答案
视频(Android的默认应用)
需要安装 InAppBrowser 插件。在您的代码中只需调用 cordova.InAppBrowser.open('videos://','_system','location = yes');
Videos (default app for android),
Requires InAppBrowser Plugin to be installed. In your code simply call cordova.InAppBrowser.open('videos://', '_system', 'location=yes');
需要相机插件。
navigator.camera.getPicture(cameraSuccess,cameraError,cameraOptions);
查看此本地设置插件
需要 InAppBrowser 待安装的插件。在您的代码中,只需调用 cordova.InAppBrowser.open('http://google.org','_system','location = yes');
这将打开默认值已安装浏览器。
Requires InAppBrowser Plugin to be installed. In your code simply call cordova.InAppBrowser.open('http://google.org', '_system', 'location=yes');
This will open the default browser installed.
许多应用程序都定义了众所周知的URL方案,可用于直接打开应用程序。这是列表。无论您使用哪个应用程序URL,请确保将其添加到 config.xml
的白名单中。
<允许意图的href = twitter:* />
<允许意图的href = mailto:* />
最新的方法是使用与URL相对应的通用链接。
Many apps have well known URL Schemes defined that you can use to open app directly with. Heres a list. Whichever app URL you're using, make sure you add it to your whitelist in config.xml
.
<allow-intent href="twitter:*" />
<allow-intent href="mailto:*" />
The more recent approach is to use Universal Links as apposed to the URL.
这篇关于从自定义cordova应用程序启动本机应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!