當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。