App Update - Android App

Android examples for App:APK Information

Description

App Update

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.pm.PackageInfo;

public class Main {
    public static boolean AppUpdate(Context ctx, float updatedVersion) {
        try {//  w w w  .  j a  va2  s.c  o  m
            PackageInfo info = ctx.getPackageManager().getPackageInfo(
                    ctx.getPackageName(), 0);
            String version = info.versionName;
            return (Float.valueOf(info.versionName) < updatedVersion) ? true
                    : false;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}

Related Tutorials