All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yy.httpproxy.util.ServiceCheckUtil Maven / Gradle / Ivy

There is a newer version: 1.1.28
Show newest version
package com.yy.httpproxy.util;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import com.yy.httpproxy.util.Log;

import java.util.List;

public class ServiceCheckUtil {

    public static boolean isServiceAvailable(Context context, Class className) {
        final PackageManager packageManager = context.getPackageManager();
        try {
            final Intent intent = new Intent(context, className);
            List resolveInfo =
                    packageManager.queryBroadcastReceivers(intent,
                            0);
            Log.d("ServiceCheckUtil", "isServiceAvailable " + className + " " + resolveInfo.size());
            return resolveInfo.size() > 0;
        } catch (Exception e) {
            return false;
        }


    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy