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);
}
Aggregations