Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3188] Titanium.Android.currentService undefined for standard services

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionNeeds more info
Resolution Date2011-04-15T03:39:03.000+0000
Affected Version/sn/a
Fix Version/sBacklog
ComponentsAndroid
Labelsandroid, defect, reported-1.6.0
ReporterDaniel Cameron
AssigneeDon Thorp
Created2011-04-15T03:39:01.000+0000
Updated2017-03-03T17:16:58.000+0000

Description

Symptoms:
Titanium.Android.currentService not set for non-interval services.

Repo steps:
1. Create new app and and myservice.js and paste code to app.js as per http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Service-object.html"> http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.And...
2. Remove type="interval" from tiapp.xml
3. Remove intent.putExtra('interval', 2000); from app.js
4. Compile and run application

Output is as follows:

[INFO] Deployed ServiceTest ... Application should be running.
[TRACE] I/Log ( 634): (main) [0,0] checkpoint, app created.
[TRACE] I/TiApplication( 634): (main) [1052,1052] Titanium 1.5.1 (2010/12/16 16:25 6bbb92)
[TRACE] D/TiApplication( 634): (main) [19,1071] Application onCreate
[TRACE] I/Log ( 634): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[TRACE] E/TiRootActivity( 634): (main) [2,2] Instance Count: 0
[TRACE] D/dalvikvm( 634): GC_FOR_MALLOC freed 3723 objects / 345688 bytes in 182ms
[TRACE] D/TiApplication( 634): (main) [539,541] Analytics Event: type=ti.start
[TRACE] D/TiApplication( 634): event=ti.start
[TRACE] D/TiApplication( 634): timestamp=2011-02-21T02:21:41.259+0000
[TRACE] D/TiApplication( 634): mid=9774d56d682e549c
[TRACE] D/TiApplication( 634): sid=ebd470c4-9680-4e45-b47a-80408a755254
[TRACE] D/TiApplication( 634): aguid=4961f916-b816-4398-b626-a2559e72498c
[TRACE] D/TiApplication( 634): isJSON=true
[TRACE] D/TiApplication( 634): payload={"os":"google_sdk","tz":0,"nettype":"MOBILE","deploytype":"development","app_version":"1.0","osver":"2.2","un":"android-build","version":"1.5.1"}
[TRACE] E/TiApplication( 634): (main) [386,927] APP PROXY: [Ti.App]
[TRACE] E/ROOT ( 634): (main) [591,1518] Leaving TiRootActivity.onCreate
[TRACE] I/Log ( 634): (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@44f43c68
[TRACE] I/TiRootActivity( 634): (Thread-10) [8,8] eval app.js
[TRACE] D/KrollContext( 634): (kroll$1) [20,28] Running evaluated script: app://app.js
[TRACE] W/TiAnalyticsSvc( 634): (Thread-11) [528,556] Analytics Service Started
[TRACE] I/ActivityManager( 60): Displayed activity com.example.com/.ServicetestActivity: 6119 ms (total 6119 ms)
[TRACE] D/dalvikvm( 634): GC_FOR_MALLOC freed 5530 objects / 357160 bytes in 116ms
[TRACE] I/TabGroupProxy( 634): (main) [876,1432] handleOpen
[TRACE] I/ActivityManager( 60): Starting activity: Intent { cmp=com.example.com/ti.modules.titanium.ui.TiTabActivity (has extras) }
[TRACE] D/TiRootActivity( 634): (main) [68,1500] root activity onPause, context = org.appcelerator.titanium.TiContext@44f43c68
[TRACE] W/TiTabActivity( 634): (main) [186,1686] Notifying TiTabGroup, activity is created
[TRACE] D/qemud ( 38): fdhandler_accept_event: accepting on fd 10
[TRACE] D/qemud ( 38): created client 0x1aed8 listening on fd 15
[TRACE] D/qemud ( 38): client_fd_receive: attempting registration for service 'sensors'
[TRACE] D/qemud ( 38): client_fd_receive: -> received channel id 14
[TRACE] D/qemud ( 38): client_registration: registration succeeded for client 14
[TRACE] D/qemud ( 38): fdhandler_event: disconnect on fd 15
[INFO] [965,2651] Service code resumes, iteration null
[TRACE] D/KrollContext( 634): (kroll$2) [47,2698] Running evaluated script: app://myservice.js
[TRACE] I/ActivityManager( 60): Displayed activity com.example.com/ti.modules.titanium.ui.TiTabActivity: 1254 ms (total 1254 ms)
[TRACE] E/KrollContext( 634): (kroll$2) [870,3568] ECMA Error evaluating source: TypeError: Cannot read property "intent" from undefined (app://myservice.js#1)
[TRACE] E/KrollContext( 634): org.mozilla.javascript.EcmaError: TypeError: Cannot read property "intent" from undefined (app://myservice.js#1)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3761)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3739)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3767)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3786)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3799)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1487)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1408)
[TRACE] E/KrollContext( 634): at script(app://myservice.js:1)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
[TRACE] E/KrollContext( 634): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
[TRACE] E/KrollContext( 634): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:195)
[TRACE] E/KrollContext( 634): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:220)
[TRACE] E/KrollContext( 634): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:115)
[TRACE] E/KrollContext( 634): at android.os.Handler.dispatchMessage(Handler.java:95)
[TRACE] E/KrollContext( 634): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/KrollContext( 634): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)
[TRACE] W/TiContext( 634): (kroll$2) [35,3603] Wanted to display an alert dialog in Javascript, but context is for a running service and therefore no attempt will be made to display a dialog in the user interface. Details: Runtime Error / TypeError: Cannot read property "intent" from undefined (app://myservice.js#1) / app://myservice.js / 1 / null
[INFO] [11,3614] Service code pauses, iteration null

Attachments

FileDateSize
ticket3188.zip2011-04-15T03:39:02.000+00004214502

Comments

  1. Daniel Cameron 2011-04-15

    Assigning to hopefully the correct person.

  2. Don Thorp 2011-04-15

    Please provide a complete test app.

  3. Daniel Cameron 2011-04-15

    Complete test app attached.

  4. Lee Morris 2017-03-03

    Closing ticket due to time passed and irrelevance of ticket.

JSON Source