IBM Worklight - 如何启动另一个应用程序? [英] IBM Worklight - How to launch another app?

查看:151
本文介绍了IBM Worklight - 如何启动另一个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在设备浏览器中请求混合应用程序时,我需要打开混合应用程序的本机版本(.ipa / .apk / .appx)。

I have a requirement to open the native version of the hybrid app (.ipa/.apk/.appx) when the hybrid app is requested in a device browser.

我能够使用 WL.Client.getEnvironment(); 方法检测环境,如果找到的话要成为Android / iPad,我想在设备中启动相应的.apk / .ipa文件。任何帮助表示赞赏。

I am able to detect the environment using WL.Client.getEnvironment(); method, if it is found to be Android/iPad, I want to launch the respective .apk/.ipa file in the device. Any help is appreciated.

推荐答案

多次重读这个问题和评论...我仍然不明白实际场景......最好改一下。

Re-reading this question and the comments several times... I still do not understand the actual scenario... it'd be best to rephrase it.

场景:如何打开应用程序网络浏览器:

如果您已将以下环境添加到Worklight应用程序:

If you have added the following environments to your Worklight application:


  • 移动网络

  • Android

  • iPhone

在访问应用程序的移动网络版时,您希望显示如需完整体验,请单击此处打开完整应用程序这样的消息。

And when visiting the Mobile Web version of your app, you want to display a message like "For the full experience, open the full application by clicking here".

然后:


  1. 暗示用户已经安装了应用程序。

  2. 如果没有安装,你需要以某种方式处理

处理这种情况的方法是使用 URI架构

The way to handle this scenario is to use URI schemas:

这意味着在将自定义URI架构添加到 AndroidManifest之后。 xml ,然后您可以检测Mobile Web应用当前正在运行的设备操作系统并显示自定义链接: myapp://<您定义的URI架构> 。点击它将打开设备上安装的应用程序。

This means that after adding the custom URI schema to AndroidManifest.xml, you could then detect the device OS the Mobile Web app is currently running on and display a custom link: myapp://<the URI schema you've defined>. Tapping it will open the app installed on the device.

对于iOS,以类似的方式: https://coderwall.com/p/mtjaeq

For iOS, in a similar fashion: https://coderwall.com/p/mtjaeq

备用解决方案:如果您不确定是否安装了应用,那么您可以始终指向Google Play或Apple App Store,而不是使用URI架构。应用页面;然后,用户将拥有打开或安装链接。

Alternate solution: If you are not sure if the app will be installed or not, then instead of using URI schemas you can always point to either Google Play or Apple App Store, to the app page; the user will then have either a "Open" or "Install" link.



场景:如何从我打开应用程序自己的应用

如果您有Worklight Hybrid应用程序(移动网络不是混合应用程序),并且您想要打开从其中的另一个应用程序,你可以:

If you have a Worklight Hybrid application (Mobile Web is not a Hybrid application), and you want to open another application from within it, you can:


  1. 使用相同的URI模式方法,或

  2. 使用 Cordova插件

  1. Use the same approach of URI schemas, or
  2. Use Cordova plug-ins

我创建了要展示的Worklight 6.1.0项目


  • Android - 如何打开Android设置应用来自您的Worklight Hybrid应用程序

  • iOS - 如何检查Waze是否已安装并打开,如果未安装Waze,则打开Apple Maps i nstead。

  • 请参阅 apps \ test 文件夹中的instructions.txt。

  • Android - How to open, for example, the Android Settings app from your Worklight Hybrid app
  • iOS - How to check if Waze is installed and open it, and if it is not installed then to open Apple Maps instead.
  • See instructions.txt in the apps\test folder.

这篇关于IBM Worklight - 如何启动另一个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆