urbanairship-core/src/main/java/com/urbanairship/iam/AudienceChecks.java
public static boolean checkAudience(@NonNull Context context, @Nullable Audience audience, @Nullable Map<String, Set<String>> tagGroups) {
        if (audience == null) {
            return true;
        }

        if (tagGroups == null) {
            tagGroups = TagSelector.EMPTY_TAG_GROUPS;
        }

        UAirship airship = UAirship.shared();
        UALocationManager locationManager = airship.getLocationManager();
        PushManager pushManager = airship.getPushManager();

        // Location opt-in
        if (audience.getLocationOptIn() != null && audience.getLocationOptIn() != locationManager.isOptIn()) {
            return false;
        }

        // Notification opt-in
        boolean notificationsOptIn = pushManager.areNotificationsOptedIn();
        if (audience.getNotificationsOptIn() != null && audience.getNotificationsOptIn() != notificationsOptIn) {
            return false;
        }

        // Locale
        if (!isLocaleConditionMet(context, audience)) {
            return false;
        }

        // Tags
        if (audience.getTagSelector() != null && !audience.getTagSelector().apply(airship.getPushManager().getTags(), tagGroups)) {
            return false;
        }

        // Version
        if (!isAppVersionConditionMet(audience)) {
            return false;
        }

        return true;
    }
/**
     * Checks the audience.
     *
     * @param context The application context.
     * @param audience The audience.
     * @param tagGroups The channel tag groups.
     * @return {@code true} if the audience conditions are met, otherwise {@code false}.
     */
Checks the audience.
@param context The application context.
@param audience The audience.
@param tagGroups The channel tag groups.
@return  true if the audience conditions are met, otherwise  false.
Checks the audience . @param context The application context . @param audience The audience . @param tagGroups The channel tag groups . @return true if the audience conditions are met otherwise false .
public static boolean checkAudience(@NonNull Context context, @Nullable Audience audience, @Nullable Map<String, Set<String>> tagGroups) {
        if (audience == null) {
            return true;
        }
        if (tagGroups == null) {
            tagGroups = TagSelector.EMPTY_TAG_GROUPS;
        }
        UAirship airship = UAirship.shared();
        UALocationManager locationManager = airship.getLocationManager();
        PushManager pushManager = airship.getPushManager();
        if (audience.getLocationOptIn() != null && audience.getLocationOptIn() != locationManager.isOptIn()) {
            return false;
        }
        boolean notificationsOptIn = pushManager.areNotificationsOptedIn();
        if (audience.getNotificationsOptIn() != null && audience.getNotificationsOptIn() != notificationsOptIn) {
            return false;
        }
        if (!isLocaleConditionMet(context, audience)) {
            return false;
        }
        if (audience.getTagSelector() != null && !audience.getTagSelector().apply(airship.getPushManager().getTags(), tagGroups)) {
            return false;
        }
        if (!isAppVersionConditionMet(audience)) {
            return false;
        }
        return true;
    }
public static boolean checkAudience ( @ NonNull Context context , @ Nullable Audience audience , @ Nullable Map < String , Set < String > > tagGroups ) { if ( audience == null ) { return true ; } if ( tagGroups == null ) { tagGroups = TagSelector . EMPTY_TAG_GROUPS ; } UAirship airship = UAirship . shared ( ) ; UALocationManager locationManager = airship . getLocationManager ( ) ; PushManager pushManager = airship . getPushManager ( ) ; if ( audience . getLocationOptIn ( ) != null && audience . getLocationOptIn ( ) != locationManager . isOptIn ( ) ) { return false ; } boolean notificationsOptIn = pushManager . areNotificationsOptedIn ( ) ; if ( audience . getNotificationsOptIn ( ) != null && audience . getNotificationsOptIn ( ) != notificationsOptIn ) { return false ; } if ( ! isLocaleConditionMet ( context , audience ) ) { return false ; } if ( audience . getTagSelector ( ) != null && ! audience . getTagSelector ( ) . apply ( airship . getPushManager ( ) . getTags ( ) , tagGroups ) ) { return false ; } if ( ! isAppVersionConditionMet ( audience ) ) { return false ; } return true ; }
Checks the audience.
Checks the audience .
// Location opt-in // Notification opt-in // Locale // Tags // Version