{ "id": "62018", "key": "TIMOB-1386", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11240", "name": "Release 1.6.0 M07", "archived": true, "released": true, "releaseDate": "2011-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:56:02.000+0000", "created": "2011-04-15T02:51:00.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "feature", "release-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:56:02.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

The default behavior is to preserve battery and pause listeners\nwhen they're not being used. If the geo listener is registered at\nthe app.js level and another Activity, even within the same app,\ncauses an onPause event the location events won't fire.

{html}", "attachment": [ { "id": "17977", "filename": "test_js_files.zip", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:51:01.000+0000", "size": 3233, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Add property to allow Geo to not be paused in onPause", "creator": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125528", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

(from [a056f7f7a3a0ddd7ffb6c79e75a3f85cfa15e040])\n[#1386 state:fixed-in-qa] full refactor of\nGeolocation module

\n

refactor of geolocation module in order to streamline logic and\nsupport manual handling of pause / resume events and the addition /\nremoval of location and heading events. Updated geolocation example\nin KS to handle the
\npause / resume events so that the location and accelerometer events\nare not forced to run in the background. Moved out Android OS\nLocation integration to a separate helper in utils. Cleaned up\nGesture and Accelerometer modules to be in line with the\nGeolocation. \nhttps://github.com/appcelerator/titanium_mobile/commit/a056f7f7a3a0...

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:01.000+0000", "updated": "2011-04-15T02:51:01.000+0000" }, { "id": "125529", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

Refactor can be verified by testing with the geolocation example\nin KS. Simply put, everything should still work as it did before.\nAs the events are no longer automatically removed on pause you\nshould see the events being manually removed when you hit back or\nhome from the example. Same for add event and resume.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:01.000+0000", "updated": "2011-04-15T02:51:01.000+0000" }, { "id": "125530", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Something seems to be really different. If I go to Settings -\nLocation on my phone (2.2) and enable both wireless networks and\nGPS, it used to be that when I went to that KS test i\ncould see up in the phone's notification area that it was using GPS\n(i.e, the antenna got turned on or whatever.) If you go back to the\ncommit just before yours -- a8f1174 -- you can see that that is the\ncase, though there is also a runtime error:

\n
\nE/KrollCallback( 1173): (kroll$8) [8,271771] Error evaluating source, invocation: [callMethod Geolocation.(anonymous) org.appcelerator.titanium.kroll.KrollCallback@46472e50], message: Wrapped java.lang.IllegalArgumentException: Expected 2 arguments for log, got 1 (app://examples/geolocation.js#342)\nE/KrollCallback( 1173): org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalArgumentException: Expected 2 arguments for log, got 1 (app://examples/geolocation.js#342)\nE/KrollCallback( 1173):     at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1781)\nE/KrollCallback( 1173):     at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:85)\nE/KrollCallback( 1173):     at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1711)\nE/KrollCallback( 1173):     at script(app://examples/geolocation.js:342)\nE/KrollCallback( 1173):     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)\nE/KrollCallback( 1173):     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)\nE/KrollCallback( 1173):     at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)\nE/KrollCallback( 1173):     at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)\nE/KrollCallback( 1173):     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)\nE/KrollCallback( 1173):     at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:139)\nE/KrollCallback( 1173):     at org.appcelerator.titanium.kroll.KrollCallback$1.run(KrollCallback.java:163)\nE/KrollCallback( 1173):     at android.os.Handler.handleCallback(Handler.java:587)\nE/KrollCallback( 1173):     at android.os.Handler.dispatchMessage(Handler.java:92)\nE/KrollCallback( 1173):     at android.os.Looper.loop(Looper.java:144)\nE/KrollCallback( 1173):     at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)\nE/KrollCallback( 1173): Caused by: java.lang.IllegalArgumentException: Expected 2 arguments for log, got 1\nE/KrollCallback( 1173):     at org.appcelerator.kroll.util.KrollBindingUtils.assertRequiredArgs(KrollBindingUtils.java:30)\nE/KrollCallback( 1173):     at ti.modules.titanium.api.APIModuleBindingGen$8.invoke(APIModuleBindingGen.java:300)\nE/KrollCallback( 1173):     at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:48)\nE/KrollCallback( 1173):     ... 12 more\n
\n

But if I test after your commit, the first time I go into the\nGeo test in KS, the GPS antenna indicator does not show.\nIf I go back to the previous screen, and then go into the test\nagain, this time the GPS antenna indicator shows (and that runtime\nerror above occurs).

\n

So it seems like the GPS is not being used anymore when you\nfirst go into the test.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125531", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [c27ef5302c68121f1252fe308e2e6eed7ae4dd34])\n[#1386] In KS geo test change all Ti.API.log() to\nTi.API.info() because log requires two args when only one was\nsupplied. \nhttps://github.com/appcelerator/titanium_mobile/commit/c27ef5302c68...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125532", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

My commit above fixes that runtime error -- it wasn't related to\nyour (Opie) commit. But my underlying issue -- the change of\nbehavior I note -- is still relevant.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125533", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

I have been doing some testing on this and I am unable to\nreproduce the issue on my Droid 2 (2.2) the way you describe. I can\nreproduce the problem if I turn off both GPS and the \"use wireless\nnetworks\" settings.

\n

If either GPS or the \"use wireless networks\" setting is enabled\n(or both) then the geo test works in general. There is a piece of\nodd behavior though that might be what your seeing. I have noticed\nthat sometimes if I am leaving and going back into the geo test\nseveral times (seems random) I will get an error stating that the\n\"gps is currently unavailable\". Once I get this error, I am not\nable to get any more proper updates for GPS unless I leave KS and\nthen come back in.

\n

I have also noticed that sometimes when that happens if I go\ninto the regular google maps app on my phone then back into KS\nthings work correctly. Part of this feels like a race condition\nbetween the cold start of the GPS versus the call to register with\nthe Location service.

\n

Will update as I dig deeper.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125534", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

After further testing, I have found that even when the GPS\nreports itself as temporarily unavailable when it comes back it\ndoes start sending the correct updates. In short, unless I turn off\nboth location features I am unable to get the geo example to stop\nworking.

\n

Tomorrow I will try and get this on another test device and see\nif the behavior can be repeated.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125535", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

This looks like the GPS is not yet warmed up when the provider\nis being selected and specified when requesting location updates.\nMight need to make periodic calls to update the active provider.\nThis might also apply to the case where your original supplied\nprovider goes away after you start listening.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:02.000+0000", "updated": "2011-04-15T02:51:02.000+0000" }, { "id": "125536", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

(from [f9036efc1f4a524603bffb8bb5ad759667a339d0])\n[#1386 state:fixed-in-qa] update geolocation\nmodule to switch providers

\n

Updated the geolocation module to check for updated location\nprovider with each new location update. While not a perfect\nsolution for handling the switching of the location providers, this\nwill allow the provider to switch based on availability without\nforcing the user to register again. Further discussion is needed\nregarding a more complete solution for handling location switching\nand response time. Also modified geolocation to completely decouple\nthe TiLocationHelper / TiCompassHelper from the proxy. Updated KS\ngeolocation example to set gps as the preferredProvider and correct\na bug in the pause / resume handling of location event\nlisteners.
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/f9036efc1f4a...

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T02:51:03.000+0000", "updated": "2011-04-15T02:51:03.000+0000" }, { "id": "125537", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

tested on 2.2 device, Titanium 1.6.0 6e8d5788

\n

With an app consisting of the attached JS files, I was able to\nconfirm...

\n
{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:51:03.000+0000", "updated": "2011-04-15T02:51:03.000+0000" }, { "id": "125538", "author": { "name": "gui", "key": "gui", "displayName": "Gui", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

It seems this fix introduced a new problem : I am unable to get\nrid of GPS in background, only if Geolocation is used with a\nmapView. It works as expected as long as you don't use the mapView,\nlike in KitchenSink. But when mapView is added to a window, I can't\nstop GPS in background even with userLocation=false and\nremoveEventListener('location'...) in the catched onPause\nevent.

{html}", "updateAuthor": { "name": "gui", "key": "gui", "displayName": "Gui", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:51:04.000+0000", "updated": "2011-04-15T02:51:04.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }