Okay. I got it working with your help, but think on Nikolay's answer. In the
end I have decided to show the EULA in  the help activity.

Thanks

On Thu, Jul 21, 2011 at 2:21 PM, Kostya Vasilyev <[email protected]> wrote:

>  Yes, you just need to keep track of version code for which the EULA was
> already shown vs. the current one.
>
> Something like this:
>
>     PackageManager packageManager = getPackageManager();
>     String packageName = getPackageName();
>     PackageInfo packageInfo;
>
>     try {
>         packageInfo = packageManager.getPackageInfo(packageName,
> PackageManager.GET_META_DATA);
>         int versionCode = packageInfo.versionCode;
>         if (versionCode != mSettings.mOldVersionCode) {
>                 // First run after an upgrade
>                 // Display the changelog and update SharedPrefs with new
> versionCode
>         }
>     }
>
> -- Kostya
>
> 21.07.2011 12:43, Raghav Sood пишет:
>
> Hi all,
>
>  I know that this thread is similar to a few previous ones but I need
> help.
>
>  I am currently using the following code to display an EULA dialog on
> first run.
>
>  SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
>
>         boolean dialogShown = settings.getBoolean("dialogShown", false);
>
>
>          if (!dialogShown) {
>
>         AlertDialog.Builder builder = new AlertDialog.Builder(this);
>
>         builder.setMessage("EULA Text.")
>
>                .setCancelable(false)
>
>                .setPositiveButton("Ok", newDialogInterface.OnClickListener() {
>
>                    public void onClick(DialogInterface dialog, int id) {
>
>                         Vortex.this.finish();
>
>                    }
>
>                });
>
>         AlertDialog alert = builder.create();
>
>
>            SharedPreferences.Editor editor = settings.edit();
>
>           editor.putBoolean("dialogShown", true);
>
>           editor.commit();
>
>         }
>
>
>  It works perfectly on the first run but when an upgrade is done the code
> fails to display the dialog. Is there any way to display the dialog on
> upgrades as well?
>
>
>  As it is using SharedPreferences I thought I could set the boolean to
> false in a way that it only happens on upgrades and only once per upgrade.
> The problem is that I don't know how.
>
>
>  Any ideas/suggestions/links?
>
>
>  Thanks
>
> --
> Raghav Sood
> http://www.raghavsood.com/
> http://wiki.androidappcheck.com/
> http://www.telstop.tel/
> https://market.android.com/developer?pub=Raghav+Sood
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> Kostya Vasilyev
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to