Java tutorial
//package com.java2s; /* * Copyright 2016 IPCO 2012 Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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 { /** * Constant for Pay by Bank app (Zapp) custom scheme. */ private static final String ZAPP_SCHEME = "zapp"; /** * Checks if there is any Pay by Bank app enabled CFI App installed on the device. * * @param context The context to use. * @return True if there is at least one PBBA enabled CFI App available, false otherwise. * @see #openBankingApp(Context, String) */ public static boolean isCFIAppAvailable(@NonNull final Context context) { //noinspection ConstantConditions if (context == null) { throw new IllegalArgumentException("context == null"); } final Intent zappIntent = new Intent(); zappIntent.setData(new Uri.Builder().scheme(ZAPP_SCHEME).build()); zappIntent.setAction(Intent.ACTION_VIEW); final ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(zappIntent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo != null; } }