urbanairship-core/src/main/java/com/urbanairship/util/ManifestUtils.java
public static void validateManifest() {

        // Validate any app push receivers
        ActivityInfo[] receivers = null;

        try {
            receivers = UAirship.getPackageManager().getPackageInfo(UAirship.getPackageName(), PackageManager.GET_RECEIVERS).receivers;
        } catch (Exception e) {
            Logger.error("Unable to query the application's receivers.", e);
        }

        if (receivers != null) {
            for (ActivityInfo info : receivers) {
                try {
                    Class receiverClass = Class.forName(info.name);
                    if (AirshipReceiver.class.isAssignableFrom(receiverClass)) {
                        if (info.exported) {
                            Logger.error("Receiver " + info.name + " is exported. This might " +
                                    "allow outside applications to message the receiver. Make sure the intent is protected by a " +
                                    "permission or prevent the receiver from being exported.");
                            throw new IllegalStateException("Receiver cannot be exported. Exporting the receiver allows other " +
                                    "apps to send fake broadcasts to this app.");
                        }
                    }
                } catch (ClassNotFoundException e) {
                    Logger.debug("ManifestUtils - Unable to find class: " + info.name, e);
                }
            }
        }
    }
/**
     * Validates the manifest for Urban Airship components.
     */
Validates the manifest for Urban Airship components.
Validates the manifest for Urban Airship components .
public static void validateManifest() {
        ActivityInfo[] receivers = null;
        try {
            receivers = UAirship.getPackageManager().getPackageInfo(UAirship.getPackageName(), PackageManager.GET_RECEIVERS).receivers;
        } catch (Exception e) {
            Logger.error("Unable to query the application's receivers.", e);
        }
        if (receivers != null) {
            for (ActivityInfo info : receivers) {
                try {
                    Class receiverClass = Class.forName(info.name);
                    if (AirshipReceiver.class.isAssignableFrom(receiverClass)) {
                        if (info.exported) {
                            Logger.error("Receiver " + info.name + " is exported. This might " +
                                    "allow outside applications to message the receiver. Make sure the intent is protected by a " +
                                    "permission or prevent the receiver from being exported.");
                            throw new IllegalStateException("Receiver cannot be exported. Exporting the receiver allows other " +
                                    "apps to send fake broadcasts to this app.");
                        }
                    }
                } catch (ClassNotFoundException e) {
                    Logger.debug("ManifestUtils - Unable to find class: " + info.name, e);
                }
            }
        }
    }
public static void validateManifest ( ) { ActivityInfo [ ] receivers = null ; try { receivers = UAirship . getPackageManager ( ) . getPackageInfo ( UAirship . getPackageName ( ) , PackageManager . GET_RECEIVERS ) . receivers ; } catch ( Exception e ) { Logger . error ( "Unable to query the application's receivers." , e ) ; } if ( receivers != null ) { for ( ActivityInfo info : receivers ) { try { Class receiverClass = Class . forName ( info . name ) ; if ( AirshipReceiver . class . isAssignableFrom ( receiverClass ) ) { if ( info . exported ) { Logger . error ( "Receiver " + info . name + " is exported. This might " + "allow outside applications to message the receiver. Make sure the intent is protected by a " + "permission or prevent the receiver from being exported." ) ; throw new IllegalStateException ( "Receiver cannot be exported. Exporting the receiver allows other " + "apps to send fake broadcasts to this app." ) ; } } } catch ( ClassNotFoundException e ) { Logger . debug ( "ManifestUtils - Unable to find class: " + info . name , e ) ; } } } }
Validates the manifest for Urban Airship components.
Validates the manifest for Urban Airship components .
// Validate any app push receivers