Search in sources :

Example 1 with AWSPredictionsService

use of com.amplifyframework.predictions.aws.service.AWSPredictionsService in project amplify-android by aws-amplify.

the class AWSPredictionsPlugin method configure.

@Override
public void configure(JSONObject pluginConfiguration, @NonNull Context context) throws PredictionsException {
    this.configuration = AWSPredictionsPluginConfiguration.fromJson(pluginConfiguration);
    AWSCredentialsProvider credentialsProvider;
    if (credentialsProviderOverride != null) {
        credentialsProvider = credentialsProviderOverride;
    } else {
        try {
            credentialsProvider = (AWSMobileClient) Amplify.Auth.getPlugin(AUTH_DEPENDENCY_PLUGIN_KEY).getEscapeHatch();
        } catch (IllegalStateException exception) {
            throw new PredictionsException("AWSPredictionsPlugin depends on AWSCognitoAuthPlugin but it is currently missing", exception, "Before configuring Amplify, be sure to add AWSPredictionsPlugin same as you added " + "AWSPinpointAnalyticsPlugin.");
        }
    }
    this.predictionsService = new AWSPredictionsService(configuration, credentialsProvider);
}
Also used : PredictionsException(com.amplifyframework.predictions.PredictionsException) AWSPredictionsService(com.amplifyframework.predictions.aws.service.AWSPredictionsService) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider)

Aggregations

AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)1 PredictionsException (com.amplifyframework.predictions.PredictionsException)1 AWSPredictionsService (com.amplifyframework.predictions.aws.service.AWSPredictionsService)1