IBM Worklight 6.1 - Questions about “Worklight Set

2020-05-06 04:45发布

问题:

I'm having some issues with the settings part on Android devices. Currently there are 2 problems:

  1. The settings page does not open. I push the settings button on my phone and then the "Worklight Settings" option appears. When I tap that the settings is supposed to appear, but it does not appear. If I press the "Worklight Settings" button and then rotate the device, the settings page appears... This bug occurred on 4.3.0, 4.2.2 and 4.0.4 (every device I tried it on). Worth noting on 4.2.2, if I sleep the screen and turn it back on, the settings page appears.

  2. The settings page button is labeled "Worklight Settings" I would like to change that and I thought modifying the following would do the trick, but it didn't seem to do anything:

    <activity android:label="Worklight Settings" android:name="com.worklight.common.WLPreferences"/>

I'm using Worklight Studio version 6.1.0.00-20131219-1900

回答1:

Issue #2
See the detailed explanation in this question: IBM Worklight - How to change the default "Worklight Settings" string?

Issue #1
Note the following warning that is printed in LogCat:

12-31 19:47:26.874: W/test(1412): Your application is using the WL.OptionsMenu API. Note that, if your application targets Android 3.0 (API level 11) or higher, WL.OptionsMenu might have no effect, depending on the device.

Documentation link

This is because in higher API Levels Google has moved on in Android to the Action Bar UI widget that replaces the Options Menu. The Android Action Bar is not yet supported in Worklight.

The way to get to Worklight Settings is by tapping a button in the Options Menu. Options Menu may work or not work in various devices in combination with higher API Levels, which explains the erratic behavior you see.

The bottom line is: that's just the way it is until Action Bar support is added. The behavior will be erratic on newer OS versions at best and may just not work.


The below experiment can be done using minSdkVersion 8, 10, 13 or 15 (which you need to install via the Android SDK), and in each you may very well see a different experience: working button, not working button, no button at all, crash on rotate, does not display in certain scenarios... and other unknown phenomenon. This is due to the lack of Action Bar support in Worklight and the changing support in Android itself between API Levels.


A new application with the Android environment in Worklight 6.0.0.1:

  • minSdkVersion: 8, Build Target 2.2, AVD using Android 2.2: working
  • minSdkVersion: 8, Build Target 4.0.3, AVD using Android 4.0.3: working
  • minSdkVersion: 8, Build Target 4.2.2, AVD using Android 4.2.2: working
  • minSdkVersion: 8, Build Target 4.3, AVD using Android 4.3: working

=====

The same application imported to Worklight 6.1.0.0:
It is upgraded to Cordova 3.1 and you also get the following message:

FWLST1124W: It is recommended that your Android application will target the same API level used to build the android project. The API level used to compile the project is specified as the Project Build Target in Project / Properties / Android dialog. Configure your application to target the same API level by adding the android:targetSdkVersion attribute to AndroidManifest.xml and setting it with the same value.

But lets not do it, so it'll be similar to yours...

  • minSdkVersion: 8, Build Target 2.2, AVD using Android 2.2: working
  • minSdkVersion: 8, Build Target 4.0.3, AVD using Android 4.0.3: working
  • minSdkVersion: 8, Build Target 4.2.2, AVD using Android 4.2.2: working
  • minSdkVersion: 8, Build Target 4.3, AVD using Android 4.3: working

=====

A new application with the Android environment in Worklight 6.1.0.0:
By default uses minSdkVersion 9, but lets use 8 to run it on Android 2.2 as well.

  • minSdkVersion: 8, targetSdkVersion: 18, Build Target 2.2, AVD using Android 2.2: fails compiling

    Because the AndroidManifest.xml now by default also uses android:configChanges="orientation|keyboardHidden|screenSize. screenSize is not supported in Android 2.2...


  • minSdkVersion: 8/13, targetSdkVersion: 18, Build Target 4.0.3, AVD using Android 4.0.3: no button
  • minSdkVersion: 8/13, targetSdkVersion: 18, Build Target 4.2.2, AVD using Android 4.2.2: no button
  • minSdkVersion: 8/13, targetSdkVersion: 18, Build Target 4.3, AVD using Android 4.3: no button

Extra reading: Relation between android:minSdkVersion, android:targetSdkVersion and "target"