[TIMOB-3292] JS service does not start when called from Android background service
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-06T18:29:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, defect, reported-1.6.0 |
Reporter | Daniel Cameron |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:41:31.000+0000 |
Updated | 2017-06-06T18:29:11.000+0000 |
Description
Titanium Mobile Version: 1.6.0
Reproduction steps:
* Create module that includes a service that runs when the
application has been closed (eg titanium-c2dm) * Add the following
the the service module:
TiJSIntervalService service = new TiJSIntervalService("c2dmHandler.js");
Intent serviceIntent = new Intent(Intent.ACTION_SEND, Uri.parse("app://c2dmHandler.js"));
serviceIntent.putExtra("interval", 2000); // work-around for
service.onStart(serviceIntent, 1);
The following stack track is dumped:
[TRACE] E/TiUncaughtHandler( 384): (IntentService[C2DMBaseReceiver]) [10,1896] Sending event: exception on thread: IntentService[C2DMBaseReceiver] msg:java.lang.NullPointerException; Titanium 1.6.0,2011/02/23 18:08,882e81
[TRACE] E/TiUncaughtHandler( 384): java.lang.NullPointerException
[TRACE] E/TiUncaughtHandler( 384): at org.appcelerator.titanium.TiBaseService.createTiContext(TiBaseService.java:126)
[TRACE] E/TiUncaughtHandler( 384): at ti.modules.titanium.android.TiJSService.createProxy(TiJSService.java:92)
[TRACE] E/TiUncaughtHandler( 384): at ti.modules.titanium.android.TiJSService.onStart(TiJSService.java:48)
[TRACE] E/TiUncaughtHandler( 384): at com.example.mobile.C2DMReceiver.jsHandleMessage(C2DMReceiver.java:92)
[TRACE] E/TiUncaughtHandler( 384): at com.example.mobile.C2DMReceiver.onMessage(C2DMReceiver.java:67)
[TRACE] E/TiUncaughtHandler( 384): at com.google.android.c2dm.C2DMBaseReceiver.onHandleIntent(C2DMBaseReceiver.java:101)
[TRACE] E/TiUncaughtHandler( 384): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
[TRACE] E/TiUncaughtHandler( 384): at android.os.Handler.dispatchMessage(Handler.java:99)
[TRACE] E/TiUncaughtHandler( 384): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/TiUncaughtHandler( 384): at android.os.HandlerThread.run(HandlerThread.java:60)
[TRACE] E/AndroidRuntime( 384): FATAL EXCEPTION: IntentService[C2DMBaseReceiver]
[TRACE] E/AndroidRuntime( 384): java.lang.NullPointerException
[TRACE] E/AndroidRuntime( 384): at org.appcelerator.titanium.TiBaseService.createTiContext(TiBaseService.java:126)
[TRACE] E/AndroidRuntime( 384): at ti.modules.titanium.android.TiJSService.createProxy(TiJSService.java:92)
[TRACE] E/AndroidRuntime( 384): at ti.modules.titanium.android.TiJSService.onStart(TiJSService.java:48)
[TRACE] E/AndroidRuntime( 384): at com.example.mobile.C2DMReceiver.jsHandleMessage(C2DMReceiver.java:92)
[TRACE] E/AndroidRuntime( 384): at com.example.mobile.C2DMReceiver.onMessage(C2DMReceiver.java:67)
[TRACE] E/AndroidRuntime( 384): at com.google.android.c2dm.C2DMBaseReceiver.onHandleIntent(C2DMBaseReceiver.java:101)
[TRACE] E/AndroidRuntime( 384): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
[TRACE] E/AndroidRuntime( 384): at android.os.Handler.dispatchMessage(Handler.java:99)
[TRACE] E/AndroidRuntime( 384): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/AndroidRuntime( 384): at android.os.HandlerThread.run(HandlerThread.java:60)
Attachments
File | Date | Size |
---|---|---|
servicenotification.zip | 2011-04-15T03:41:34.000+0000 | 10394531 |
Workaround: fire the intent directly instead of creating a TiService
Assigning to hopefully the correct person.
Daniel it would be helpful if you could attach a complete example to speed up the reproduction and possible fix.
Full source for reproduction against 1.6.1 attached.
Reproduction steps:
Start "Ticket3292" app
Start "Ticket3292 invoker" app
Select the "Notification to native service invoking js" notification