0

I'm having issues with the Worklight location API on Android emulator. I am using IBM Worklight Studio 6.2.0.01-20141027-1531 and Android emulator os level 4.4.2.

After updating the emulator location, these are the logs that I'm seeing:

W/PluginManager( 3350): THREAD WARNING: exec() call to WLGeolocationPlugin.getLocation blocked the main thread for 57ms. Plugin should use CordovaInterface.getThreadPool().
D/com.worklight.androidgap.plugin.WLLocationListener( 3350): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3350): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 29991929 milliseconds. More than maximumAge of 10000 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3350): WLLocationListener.onStatusChanged in WLLocationListener.java:156 :: The status of the provider gps has changed
D/com.worklight.androidgap.plugin.WLLocationListener( 3350): WLLocationListener.onStatusChanged in WLLocationListener.java:162 :: gps is TEMPORARILY_UNAVAILABLE

The only way I can see the location listener catching and updating my UI is by setting the maximumAge higher than 29991929 - for example 299919290. I don't really understand where this 29991929 age comes from considering I just updated the location. Surely it should be a few milliseconds rather than 29991929+

Also if I set a crazy large number such as 299919290, I only get the first location update. After that, no matter how often I change the location, those changes are not picked up:

D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30321246 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30320408 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30319563 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30318722 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30317902 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30317066 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.onLocationChanged in WLLocationListener.java:174 :: The location has been updated!
D/com.worklight.androidgap.plugin.WLLocationListener( 3452): WLLocationListener.win in WLLocationListener.java:100 :: Acquired location age: 30316258 milliseconds. More than maximumAge of 100 milliseconds. Ignoring.

Works fine on my actual device, however I need to get this working on the emulator.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
vkislicins
  • 3,331
  • 3
  • 32
  • 62

1 Answers1

2

Unfortunately, the emulator always starts off giving the time as midnight (this is a known defect). Since it appears that you're using a Hybrid environment you should be able to test inside the Mobile Browser Simulator - you may want to use the Scenario Widget there to allow you to easily test different scenarios in a repeatable way. Alternatively, you can try using mock locations or IBM Rational Test Workbench (read this answer for more).

MotiNK
  • 421
  • 2
  • 12