Can we get the app version and IP address info usi

2020-05-06 13:36发布

问题:

In my worklight hybrid app, I want to get two info:

  1. app version (the version the end-user sees in the various App Stores or in the device)
  2. IP address

How can I do it?

回答1:

IP address: The Worklight Hybrid application does not have any IP address. The client (the app...) connects to the Worklight Server. The IP address you set the client to connect to is set in application-descriptor.xml as the value of worklightServerRootURL.

If you mean that you're actually looking for the device IP address, you can get this using WL.Device.getNetworkInfo.

App version: Like with the IP address, the "version" of the Worklight application is set as well in application-descriptor.xml as an attribute of the environment element.

<android version="1.0">
...
...
...
</android>

You can retrieve it by using WL.Client.getAppProperty("APP_VERSION").