title: Phone freezes when uninstalling the application
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>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. </p>
  
  <p><em>So to summarise my rambles,</em></p>
  
  <p><strong>Problem:</strong> 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.</p>
  
  <p><strong>My guess of the cause:</strong></p>
  
  <ul>
  <li><p>My background service is still running and collides with the uninstallation (sounds likely but this never happened in the previous versions)</p></li>
  <li><p>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)</p></li>
  <li><p>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)</p></li>
  <li><p>The phone I have is crappy and hates my application (sounds unlikely but possible)</p></li>
  </ul>
  
  <p>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. </p>