Programmatically update app
<p>I am using timer(triggers every 2 hours) to check for any update in my app. If there is any update available, it will automatically download the latest .apk and pro grammatically starts the installation activity. (window with OK and CANCEL button)</p>

<p><strong>Now the problem is :</strong>
   If the user doesn't click "OK" or "CANCEL". Then the <strong>popup still exists</strong>. So, in the next timer hit (after 2 hours). It is downloading latest .apk, popups another installation activity.so now 2 activity window is displayed. Then for the next timer hit, it will 3 popup activity window (if the user still doesn't chooses OK or CANCEL)</p>

<p>Is there any better way to avoid displaying multiple window.</p>

<p><strong>Please find my code below :</strong></p>

<pre><code>public void onActivityResult(int requestCode, int resultCode, Intent intent) 
{
      if (requestCode == 3)
      {
       isUpdating = false;            
      }
}


private void fnCheckforUpdate()
{
    ........
    .......
    if(false==isUpdating)
{
          Intent intent = new Intent(Intent.ACTION_VIEW);                                      
         intent.setDataAndType(Uri.fromFile(outputFile), "application/vnd.android.package-archive");
         isUpdating = true;
         startActivityForResult(intent, 3);
    }
}
</code></pre>
