First time post.
I'm having a very frustrating time developing for the Nokia 6131 NFC. In the Emulator my application runs fine, when running on the real device however, I've started the habit to light a candle and pray..
Setup :
- Uses GameCanvas to Paint 2D Graphics that make up UI, Class implements Runnable and refreshes screen periodically with Thread.sleep() cycles in between. (Thread is started with ShowNotify() method and stopped with HideNotify().)
- Uses Contactless-API to read Tag-IDs from NFC-Tags in the same Class. targetDetected Handler spawns a new Thread immediately and then returns. (As suggested in the API Docs.)
This spawned Thread includes :
- Play a Soundfile (.wav) to notify user that a tag has been detected.
- Call methods in Data Management Class to store tag-id information along with timestamp. (Data is stored in RMS.)
- Setting a couple of flags in the graphics class to display information on screen when the UI Thread refreshes next time.
Now the problems I have :
- Unexpected Crashes. Suddendly Screen will go blank and application will restart. RecordStore will be most probably corrupt and data gone in most cases. (Worst-Case on a regular basis..)
Can happen after first tag is scanned, can go on for 1000 tags (tested!) and not crash at all. It is a for me absolutely not reproducible error.
Steps taken :
- After reading about sound playback issues with some phones I've removed sound playback. To my surprise : Much greater stability, however still not 100% reliable. (besides: we need that beep-sound)
- I'm checking memory usage, lots of free memory. Calling Garbage Collection after scanning to stabilize it even more.
Biggest open problem :
- How can I make the RecordStore proof against data loss if the app crashes? Use some kind of JSR-75 backup solution perhaps? I thought of running two record stores to increase chance of recovery, too..
Now.. I wonder if any one else had a similar hard time with the 6131 NFC. And perhaps an experienced user can give me general guidelines to make my App more stable.
I had similar restart problems before I upgraded our 6131NFC phones to the latest firmware version.
It got much better after the update. Eventually sometimes it restarts, but with a very very low frequency.