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)
Now the problem is :
If the user doesn’t click “OK” or “CANCEL”. Then the popup still exists. 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)
Is there any better way to avoid displaying multiple window.
Please find my code below :
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);
}
}
You can check showing dialog: