Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.support.annotation.NonNull;

public class Main {
    public static final String ZAPP_SCHEME = "zapp";

    /**
     * Checks if there is any of the CFI apps installed on the device supports PBBA payment.
     *
     * @param context application context
     * @return true if available
     */
    public static boolean isZappCFIAppAvailable(@NonNull final Context context) {
        final Intent zappIntent = new Intent();
        zappIntent.setAction(Intent.ACTION_VIEW);
        zappIntent.setData(new Uri.Builder().scheme(ZAPP_SCHEME).build());
        final ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(zappIntent,
                PackageManager.MATCH_DEFAULT_ONLY);
        return resolveInfo != null;
    }
}