urbanairship-core/src/main/java/com/urbanairship/PushProviders.java
@NonNull
    private List<PushProvider> createProviders() {
        List<PushProvider> providers = new ArrayList<>();
        List<String> providerClasses = new ArrayList<>();

        for (String className : Arrays.asList(FCM_PUSH_PROVIDER_CLASS, GCM_PUSH_PROVIDER_CLASS, ADM_PUSH_PROVIDER_CLASS)) {
            PushProvider pushProvider = null;
            try {
                Class providerClass = Class.forName(className);
                pushProvider = (PushProvider) providerClass.newInstance();
            } catch (InstantiationException e) {
                Logger.error("Unable to create provider " + className, e);
            } catch (IllegalAccessException e) {
                Logger.error("Unable to create provider " + className, e);
            } catch (ClassNotFoundException e) {
                continue;
            }

            if (pushProvider == null) {
                continue;
            }

            if (pushProvider instanceof AirshipVersionInfo) {
                AirshipVersionInfo versionInfo =  (AirshipVersionInfo)pushProvider;
                Logger.verbose("Found provider: " + pushProvider + " version: " + versionInfo.getPackageVersion());

                if (!UAirship.getVersion().equals(versionInfo.getAirshipVersion())) {
                    Logger.error("Provider: " + pushProvider + " version " + versionInfo.getAirshipVersion() + " does not match the SDK version " + UAirship.getVersion() + ". Make sure all Urban Airship dependencies are the exact same version.");
                    continue;
                }
            }

            providers.add(pushProvider);
            providerClasses.add(className);
        }

        if (providerClasses.contains(FCM_PUSH_PROVIDER_CLASS) && providerClasses.contains(GCM_PUSH_PROVIDER_CLASS)) {
            Logger.error("Both urbanairship-gcm and urbanairship-fcm packages detected. Having both installed is not supported.");
        }

        return providers;
    }
/**
     * Creates the list of push providers.
     *
     * @return The list of push providers.
     */
Creates the list of push providers.
@return The list of push providers.
Creates the list of push providers . @return The list of push providers .
@NonNull
    private List<PushProvider> createProviders() {
        List<PushProvider> providers = new ArrayList<>();
        List<String> providerClasses = new ArrayList<>();
        for (String className : Arrays.asList(FCM_PUSH_PROVIDER_CLASS, GCM_PUSH_PROVIDER_CLASS, ADM_PUSH_PROVIDER_CLASS)) {
            PushProvider pushProvider = null;
            try {
                Class providerClass = Class.forName(className);
                pushProvider = (PushProvider) providerClass.newInstance();
            } catch (InstantiationException e) {
                Logger.error("Unable to create provider " + className, e);
            } catch (IllegalAccessException e) {
                Logger.error("Unable to create provider " + className, e);
            } catch (ClassNotFoundException e) {
                continue;
            }
            if (pushProvider == null) {
                continue;
            }
            if (pushProvider instanceof AirshipVersionInfo) {
                AirshipVersionInfo versionInfo =  (AirshipVersionInfo)pushProvider;
                Logger.verbose("Found provider: " + pushProvider + " version: " + versionInfo.getPackageVersion());
                if (!UAirship.getVersion().equals(versionInfo.getAirshipVersion())) {
                    Logger.error("Provider: " + pushProvider + " version " + versionInfo.getAirshipVersion() + " does not match the SDK version " + UAirship.getVersion() + ". Make sure all Urban Airship dependencies are the exact same version.");
                    continue;
                }
            }
            providers.add(pushProvider);
            providerClasses.add(className);
        }
        if (providerClasses.contains(FCM_PUSH_PROVIDER_CLASS) && providerClasses.contains(GCM_PUSH_PROVIDER_CLASS)) {
            Logger.error("Both urbanairship-gcm and urbanairship-fcm packages detected. Having both installed is not supported.");
        }
        return providers;
    }
@ NonNull private List < PushProvider > createProviders ( ) { List < PushProvider > providers = new ArrayList < > ( ) ; List < String > providerClasses = new ArrayList < > ( ) ; for ( String className : Arrays . asList ( FCM_PUSH_PROVIDER_CLASS , GCM_PUSH_PROVIDER_CLASS , ADM_PUSH_PROVIDER_CLASS ) ) { PushProvider pushProvider = null ; try { Class providerClass = Class . forName ( className ) ; pushProvider = ( PushProvider ) providerClass . newInstance ( ) ; } catch ( InstantiationException e ) { Logger . error ( "Unable to create provider " + className , e ) ; } catch ( IllegalAccessException e ) { Logger . error ( "Unable to create provider " + className , e ) ; } catch ( ClassNotFoundException e ) { continue ; } if ( pushProvider == null ) { continue ; } if ( pushProvider instanceof AirshipVersionInfo ) { AirshipVersionInfo versionInfo = ( AirshipVersionInfo ) pushProvider ; Logger . verbose ( "Found provider: " + pushProvider + " version: " + versionInfo . getPackageVersion ( ) ) ; if ( ! UAirship . getVersion ( ) . equals ( versionInfo . getAirshipVersion ( ) ) ) { Logger . error ( "Provider: " + pushProvider + " version " + versionInfo . getAirshipVersion ( ) + " does not match the SDK version " + UAirship . getVersion ( ) + ". Make sure all Urban Airship dependencies are the exact same version." ) ; continue ; } } providers . add ( pushProvider ) ; providerClasses . add ( className ) ; } if ( providerClasses . contains ( FCM_PUSH_PROVIDER_CLASS ) && providerClasses . contains ( GCM_PUSH_PROVIDER_CLASS ) ) { Logger . error ( "Both urbanairship-gcm and urbanairship-fcm packages detected. Having both installed is not supported." ) ; } return providers ; }
Creates the list of push providers.
Creates the list of push providers .