package org.ligi.axt.extensions;

import android.content.Intent;
import android.content.pm.PackageManager;

public class IntentAXT {

    private final Intent intent;

    public IntentAXT(Intent intent) {
        this.intent = intent;
    }

    /**
     * Indicates whether the specified action can be used as an intent. This
     * method queries the package manager for installed packages that can
     * respond to an intent with the specified action. If no suitable package is
     * found, this method returns false.
     *
     * @param pm
     * @return
     */
    public boolean isIntentAvailable(PackageManager pm) {
        return isIntentAvailable(pm, PackageManager.MATCH_DEFAULT_ONLY);
    }

    public boolean isIntentAvailable(PackageManager pm, int flags) {
        return pm.queryIntentActivities(intent, flags).size() > 0;
    }

    /**
     * Indicates whether the specified action can be used as an service. This
     * method queries the package manager for installed packages that can
     * respond to an service with the specified action. If no suitable package is
     * found, this method returns false.
     *
     * @param pm
     * @return
     */
    public boolean isServiceAvailable(PackageManager pm) {
        return pm.queryIntentServices(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
    }

    public boolean isServiceAvailable(PackageManager pm, int flags) {
        return pm.queryIntentServices(intent, flags).size() > 0;
    }


}

@@ -54,56 +54,188 @@
 ent.
-Intent;%0Aimport android.content.pm.PackageManager
+ComponentName;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.content.pm.PackageManager;%0Aimport android.content.pm.ResolveInfo;%0Aimport java.util.List
 ;%0A%0Ap
@@ -1608,11 +1608,628 @@
 %0A    %7D%0A%0A
+    public Intent makeExplicit(final Context context) %7B%0A        final PackageManager pm = context.getPackageManager();%0A        final List%3CResolveInfo%3E resolveInfo = pm.queryIntentServices(intent, 0);%0A%0A        if (resolveInfo == null) %7B%0A            return null;%0A        %7D%0A%0A        final ResolveInfo serviceInfo = resolveInfo.get(0);%0A        final String packageName = serviceInfo.serviceInfo.packageName;%0A        final String className = serviceInfo.serviceInfo.name;%0A        final ComponentName component = new ComponentName(packageName, className);%0A%0A        return new Intent(intent).setComponent(component);%0A    %7D%0A%0A
 %0A%7D%0A

Add function to make explicit intent from implicit one