0

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

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
Jonathan Sweetman
  • 605
  • 1
  • 6
  • 16

1 Answers1

0

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"

Community
  • 1
  • 1
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • My AndroidManifest.xml does not have a taretSdkVersion already. It only uses android:minSdkVersion="8". This problem started occurring around the time I upgraded my Worklight from 6.0 to 6.1. Another developer is using the same AndroidManifest as me (but still on Worklight 6.0) was able to deploy the application onto my device and the menu works. Maybe there's a problem with 6.1? Also I tried changing WL.ClientMessages.wlSettings before the function wlCommonInit(), but it didn't work. Could it have something to do with my sdk versions in the Android Manifest? – Jonathan Sweetman Jan 02 '14 at 15:39
  • Sorry, I don't know what you're doing there. If you want you can send me the project and I'll give it a look when I find the time; also, please do mention all details next time... you only now mention you performed an UPGRADE. Send the project with its state BEFORE it was upgraded. – Idan Adar Jan 02 '14 at 15:43
  • Yeah sorry I didn't realize I had also performed an upgrade recently until now. – Jonathan Sweetman Jan 02 '14 at 15:56
  • I've tried checking out older versions of the code where the menu works and then building with version 6.1 and deploying onto my phone and the menu still does not work. I'll work on seeing if I can send you the code before version 6.1 changes are applied, thanks. – Jonathan Sweetman Jan 02 '14 at 16:57
  • No need. See my updated answer. I tested all environments. That's just the way it is. – Idan Adar Jan 02 '14 at 17:27