PackageManager queryBroadcastReceivers - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager queryBroadcastReceivers method.

This code example shows how to use the following methods:queryBroadcastReceivers
    } 
 
    public static boolean isBroadcastAvailable(Context ctx, String action) {
        final PackageManager packageManager = ctx.getPackageManager();
        final Intent intent = new Intent(action);
        return packageManager.queryBroadcastReceivers(intent, 0).size() > 0;
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:queryBroadcastReceivers
	 */ 
	@Override 
	public boolean isReceiverAvailable(Context context, Class<?> cls) {
	    final PackageManager packageManager = context.getPackageManager();
	    final Intent intent = new Intent(context, cls);
	    return packageManager.queryBroadcastReceivers(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
	}	 
	 
	/* (non-Javadoc) 
	 * @see com.socialize.util.IAppUtils#isLocationAvaiable(android.content.Context) 
	 */ 
	@Override 
	public boolean isLocationAvailable(Context context) {
		if(!locationAssessed && config != null) {
			locationAvailable = config.getBooleanProperty(SocializeConfig.SOCIALIZE_LOCATION_ENABLED, true) && (hasPermission(context, "android.permission.ACCESS_FINE_LOCATION") || hasPermission(context, "android.permission.ACCESS_COARSE_LOCATION"));
			locationAssessed = true;
		} 
		return locationAvailable;
	} 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:queryBroadcastReceivers
        } 
    } 
 
    public void toggleState(Context context) {
        PackageManager pm = mContext.getPackageManager();
        List<ResolveInfo> l = pm.queryBroadcastReceivers(new Intent(
                "net.cactii.flash2.TOGGLE_FLASHLIGHT"), 0); 
        if (!l.isEmpty()) {
            mContext.sendBroadcast(new Intent("net.cactii.flash2.TOGGLE_FLASHLIGHT"));
        } else { 
            Intent intent = new Intent(context, FlashlightActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        } 
    } 
 
    public static FlashlightButton getInstance() { 
        if (ownButton == null)
            ownButton = new FlashlightButton();
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:queryBroadcastReceivers
	 *         responded to, false otherwise. 
	 */ 
	public static boolean doesIntentHaveReceivers(final Context context, final String action) {
		final PackageManager packageManager = context.getPackageManager();
		final Intent intent = new Intent(action);
		final List<ResolveInfo> list = packageManager.queryBroadcastReceivers(intent, 0);
		return list.size() > 0;
	} 
 
	public static boolean isApplicationInstalled(final Context context, final String packageName) {
		final PackageManager packageManager = context.getPackageManager();
		try { 
			packageManager.getApplicationInfo(packageName, 0);
			return true; 
		} catch (final NameNotFoundException whocares) {
			return false; 
		} 
	} 
 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:queryBroadcastReceivers
        return wrapped.queryIntentActivityOptions(caller, specifics, intent, flags);
    } 
 
    @Override 
    public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
        return wrapped.queryBroadcastReceivers(intent, flags);
    } 
 
    @Override 
    public ResolveInfo resolveService(Intent intent, int flags) {
        return wrapped.resolveService(intent, flags);
    } 
 
    @Override 
    public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
        return wrapped.queryIntentServices(intent, flags);
    } 
 
    @Override 
    public ProviderInfo resolveContentProvider(String name, int flags) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:queryBroadcastReceivers
        List<ResolveInfo> relt = null;
 
        // 获取其他push模块的信息 
        Intent queryIntent = new Intent("com.baidu.android.pushservice.action.BIND_SYNC");
        PackageManager pm = ctx.getPackageManager();
        relt = pm.queryBroadcastReceivers(queryIntent, 0);
 
        return relt;
    } 
     
    public static List<ResolveInfo> getFriendPackagesJpush(Context ctx) {
        List<ResolveInfo> relt = null;
 
        // 获取其他push模块的信息 
        Intent queryIntent = new Intent("cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY");
        PackageManager pm = ctx.getPackageManager();
        relt = pm.queryBroadcastReceivers(queryIntent, 0);
 
        return relt;
    } 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related PackageManager queryBroadcastReceivers Questions & Answers:

queryBroadcastReceivers Method Overview
Retrieve all receivers that can handle a broadcast of the given intent.
See Code Examples for other Android PackageManager Methods: