Skip to content

RetrievingVersionInfo

DangChien edited this page Oct 9, 2015 · 2 revisions

Introduction

Sometimes it is needed to know the SmartCard API version info.

This can be accomplished without bothering an SmartCard API function but using following method.

Details

Following method retrieves the version info of the SmartCard API:

    private String getScapiVersion() {
        try {
            PackageInfo packageInfo = getPackageManager().getPackageInfo("android.smartcard", 0);
            return packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException e1) {
            try {
                PackageInfo packageInfo =  getPackageManager().getPackageInfo("org.simalliance.openmobileapi.service", 0);
                return packageInfo.versionName;
            } catch (PackageManager.NameNotFoundException e2) {
                try {
                    PackageInfo packageInfo = getPackageManager().getPackageInfo("com.sonyericsson.smartcard", 0);
                    return packageInfo.versionName;
                } catch (PackageManager.NameNotFoundException e3) {
                    return "";
                }
            }
        }
    }
Clone this wiki locally