当前位置: 首页>>代码示例>>Java>>正文


Java IntentFilter.hasAction方法代码示例

本文整理汇总了Java中android.content.IntentFilter.hasAction方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.hasAction方法的具体用法?Java IntentFilter.hasAction怎么用?Java IntentFilter.hasAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.IntentFilter的用法示例。


在下文中一共展示了IntentFilter.hasAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReceiverName

import android.content.IntentFilter; //导入方法依赖的package包/类
private ActivityInfo getReceiverName (String pkg,
                                       PackageManager packageManager) {
    Intent intent = new Intent();
    intent.setPackage(pkg);
    //intent.setAction(Constants.ACTION_RECEIVE_MESSAGE);
    for (ResolveInfo resolveInfo : packageManager.queryBroadcastReceivers(intent,
            PackageManager.GET_RESOLVED_FILTER |
                    PackageManager.GET_DISABLED_COMPONENTS)) {
        ActivityInfo activityInfo = resolveInfo.activityInfo;
        if (!activityInfo.packageName.equals(pkg))
            continue;
        IntentFilter filter = resolveInfo.filter;
        if (filter != null && filter.hasAction(Constants.ACTION_RECEIVE_MESSAGE)) {
            return activityInfo;
        }
    }
    // Not found
    return null;
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:20,代码来源:CheckAppSupportActivity.java

示例2: customReceiverPass

import android.content.IntentFilter; //导入方法依赖的package包/类
/**
 * Check package's MiPush custom receiver (handle com.xiaomi.mipush.RECEIVE_MESSAGE action)
 * is enabled.
 * @see PushMessageReceiver
 * @see Constants#ACTION_RECEIVE_MESSAGE
 * @param info Package info
 * @return enable status. If this package not have custom receiver, will
 * still returns true.
 */
private boolean customReceiverPass (PackageInfo info, PackageManager packageManager) {
    //if (info.receivers == null)
    //    return true;
    Intent intent = new Intent();
    intent.setPackage(info.packageName);
    //intent.setAction(Constants.ACTION_RECEIVE_MESSAGE);
    for (ResolveInfo resolveInfo : packageManager.queryBroadcastReceivers(intent,
            PackageManager.GET_RESOLVED_FILTER |
    PackageManager.GET_DISABLED_COMPONENTS)) {
        ActivityInfo activityInfo = resolveInfo.activityInfo;
        if (!activityInfo.packageName.equals(info.packageName))
            continue;
        IntentFilter filter = resolveInfo.filter;
        if (filter != null && filter.hasAction(Constants.ACTION_RECEIVE_MESSAGE)) {
            boolean enabled = packageManager.getComponentEnabledSetting(new ComponentName(
                    activityInfo.packageName, activityInfo.name
            )) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
            Log4a.i(TAG, "Handle receiver: " + activityInfo.name +
            "; enabled: " + enabled);
            return enabled;
        }
    }
    Log4a.d(TAG, "Not found custom message receiver in " + info.packageName);
    // Not found
    return true;
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:36,代码来源:CheckSupportUtils.java

示例3: filterEquals

import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean filterEquals(IntentFilter f1, IntentFilter f2) {
	int s1 = f1.countActions();
	int s2 = f2.countActions();
	if (s1 != s2) {
		return false;
	}
	for (int i = 0; i < s1; i++) {
		if (!f2.hasAction(f1.getAction(i))) {
			return false;
		}
	}
	s1 = f1.countCategories();
	s2 = f2.countCategories();
	if (s1 != s2) {
		return false;
	}
	for (int i = 0; i < s1; i++) {
		if (!f2.hasCategory(f1.getCategory(i))) {
			return false;
		}
	}
	s1 = f1.countDataTypes();
	s2 = f2.countDataTypes();
	if (s1 != s2) {
		return false;
	}
	s1 = f1.countDataSchemes();
	s2 = f2.countDataSchemes();
	if (s1 != s2) {
		return false;
	}
	for (int i = 0; i < s1; i++) {
		if (!f2.hasDataScheme(f1.getDataScheme(i))) {
			return false;
		}
	}
	s1 = f1.countDataAuthorities();
	s2 = f2.countDataAuthorities();
	if (s1 != s2) {
		return false;
	}
	s1 = f1.countDataPaths();
	s2 = f2.countDataPaths();
	if (s1 != s2) {
		return false;
	}
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		s1 = f1.countDataSchemeSpecificParts();
		s2 = f2.countDataSchemeSpecificParts();
		if (s1 != s2) {
			return false;
		}
	}
	return true;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:56,代码来源:IntentResolver.java

示例4: filterEquals

import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean filterEquals(IntentFilter f1, IntentFilter f2) {
    int s1 = f1.countActions();
    int s2 = f2.countActions();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasAction(f1.getAction(i))) {
            return false;
        }
    }
    s1 = f1.countCategories();
    s2 = f2.countCategories();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasCategory(f1.getCategory(i))) {
            return false;
        }
    }
    s1 = f1.countDataTypes();
    s2 = f2.countDataTypes();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasExactDataType(f1.getDataType(i))) {
            return false;
        }
    }
    s1 = f1.countDataSchemes();
    s2 = f2.countDataSchemes();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasDataScheme(f1.getDataScheme(i))) {
            return false;
        }
    }
    s1 = f1.countDataAuthorities();
    s2 = f2.countDataAuthorities();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasDataAuthority(f1.getDataAuthority(i))) {
            return false;
        }
    }
    s1 = f1.countDataPaths();
    s2 = f2.countDataPaths();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasDataPath(f1.getDataPath(i))) {
            return false;
        }
    }
    s1 = f1.countDataSchemeSpecificParts();
    s2 = f2.countDataSchemeSpecificParts();
    if (s1 != s2) {
        return false;
    }
    for (int i=0; i<s1; i++) {
        if (!f2.hasDataSchemeSpecificPart(f1.getDataSchemeSpecificPart(i))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:74,代码来源:IntentResolver.java


注:本文中的android.content.IntentFilter.hasAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。