GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-05-13T20:18:43.000+0000 |
Affected Version/s | Release 3.0.2 |
Fix Version/s | 2013 Sprint 10 Core, 2013 Sprint 10 |
Components | Android |
Labels | broadcastReceiver, exalture, module, titanium |
Reporter | Ashish Nigam |
Assignee | jithinpv |
Created | 2013-03-18T14:22:26.000+0000 |
Updated | 2013-11-07T17:57:18.000+0000 |
App crashes when we create any UI component inside the eventFired from this particular module and trying to access UI component method after pressing back button and launching again.
sample app and module code is attached.
Steps:
1: Launch the app in android any version (preferred is 4.2 or 2.2).
2: click on Add device button.
3: Click on red view add and an alert will be shown, click ok.
4: press the back button, and app will go in background.
5: launch the app again.
6: Press the Add Device button again.
7: App crashes.
Another thing to try.
1: Go to sample app's app.js at line number 71-72 and comment the view1 addEventListener.
2: Launch the app again and now repeat the above process.
3: app won't crash.
Cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 Android Emulator: Android SDK version: 2.2
Cannot reproduce the issue each time on android 2.2.2.Once it got reproduced in fourth attempt for 3.0.2.GA build only but never after that. Environment used for verification- SDK - 3.0.2.GA,3.1.0.GA,3.1.1.v20130503173050 Appcelerator studio - 3.1.1.201305031846 Device : LG-P970 Android 2.2.2 But it was reproducible every time on android 4.1 with below environment SDK - 3.0.2.GA,3.1.0.GA,3.1.1.v20130503173050 Appcelerator studio - 3.1.1.201305031846 Device : nexus 7 Android 4.1 Same behaviour as above is shown on titanium studio build : 3.1.0.201304171607.Working fine for android 2.2.2 but crashing on android 4.1.
This bug is not valid. When using broadcast receivers the runtime needs to be kept alive from the module end. You would need to call something like KrollRuntime.incrementServiceReceiverRefCount(); when registering, and then the corresponding when you want to ungregister the broadcast receiver. Also, there isn't really a need to create a module for broadcast receivers. You can accomplish the same thing with a titanium API: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.BroadcastReceiver
Closing it as per the comment by Allen, its being invalid.