I'm developing an android application which uses background service. I have not had much experience with android application development and this is my first application. I have been producing numerous alpha versions and recently did a major change in the code and have experienced the freezing problem when trying to uninstall the application. This problem never happened in the previous versions so I'm suspecting that something I changed is causing this. After the version change, I'm using sqlite database to store some of my data. The table isn't that large and only has about 5 rows max, but there are about 5 or 6 columns. I'm using two databases, both of the similar size. In both previous and current version I'm using threads to do Bluetooth file transfer and there are a few AsyncTasks which does database read/write and sending emails.
I have tested on three different phones; Nexus S, Samsung Galaxy S II (I9100) and Samsung Galaxy Mini (S5570). It runs fine on all phones, but when I try to uninstall the application on Galaxy Mini the phone shows uninstalling screen with progress bar then freezes. The screen turns off and doesn't respond to any buttons. If I wait for a while, the Samsung logo shows up like it is rebooting, but it doesn't actually reboot. The only way I can get out of that screen is either long power button press which forces power off, or the removal of battery then restarting the phone.
I am suspecting that it is the memory or CPU problem because this problem never happens on the other phones. I have tried to diagnose this problem by observing the logcat but I don't see any fatal error messages. I have tried installing other well-known applications in the market which are large in size and tried to reproduce the problem but it uninstalls without freezing, so I am pretty sure it is my application that is causing the freezing.
I would really appreciate any help or information on this. I have identified a few memory leaks in my application and I'm in the process of removing it, but I don't see how this would cause freezing during uninstall. When I check the phone's memory there are 120MB+ free space in internal memory and I'm not using the external memory. One thing I noticed was the CPU usage. I monitored the CPU clock and memory using SystemPanel application and observed that Galaxy mini's CPU clock is on the very high percentage.
So to summarise my rambles,
Problem: Galaxy Mini phone freezes when I try to uninstall my application. This problem only happens on Galaxy Mini (out of three phones) and only for my application.
My guess of the cause:
My background service is still running and collides with the uninstallation (sounds likely but this never happened in the previous versions)
Deleting of application files take long and is too straining for the Galaxy Mini CPU (sounds unlikely because the max size of my app is less than 5MB, and I tried uninstalling Angry Birds which was about 25MB+ in size)
My application is leaking memory so much it uses up all the heap memory and triggers GC all the time, and since Galaxy Mini is Froyo the whole phone freezes up and results in being stuck in somewhere (sounds likely but freezing doesn't happen when the application is actually running)
The phone I have is crappy and hates my application (sounds unlikely but possible)
Thanks for taking your time to read through a rather long post, and I would really appreciate any input or suggestions on the possible cause, or the possible solutions to this problem.
Assuming your application runs normally in general on the Galaxy Mini (e.g., the CPU issue is only during the uninstall), then you are tripping over some firmware bug in the Galaxy Mini. Since you don't get control at the time of an uninstall, you have no responsibilities to do anything at that point. If Samsung has a problem uninstalling your app, that's Samsung's fault, not yours.
Now, if your app is more generally misbehaving on the Galaxy Mini (e.g., device runs sluggishly in general when your app is in operation), that may be indicative of a fault in your app, which the uninstall process is just generally exacerbating.