Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidPubSub Sample does not work!!! #308

Closed
wants to merge 3 commits into from
Closed

AndroidPubSub Sample does not work!!! #308

wants to merge 3 commits into from

Conversation

iwwork
Copy link

@iwwork iwwork commented Feb 22, 2019

Followed the instruction https://github.com/awslabs/aws-sdk-android-samples/tree/master/AndroidPubSub to set the parameter on the AWS cloud

Downloaded the whole code from https://github.com/awslabs/aws-sdk-android-samples

Used Android Studio 3.3.1 to open the folder AndroidPubSub

Changed the following part
PubSubActivity.java
// IoT endpoint
// AWS Iot CLI describe-endpoint call returns: XXXXXXXXXX.iot..amazonaws.com
private static final String CUSTOMER_SPECIFIC_ENDPOINT = "REPLACE_ME";
// Name of the AWS IoT policy to attach to a newly created certificate
private static final String AWS_IOT_POLICY_NAME = "REPLACE_ME";

awsconfiguration.json
"PoolId": "REPLACE_ME",
"Region": "Regions.US_EAST_1"

Sync, Build and Run App on emulator9.0 or Mobile Phone8.0, the result in Logcat is

com.amazonaws.demo.androidpubsub W/o.androidpubsu: Verification of com.amazonaws.logging.Log com.amazonaws.logging.LogFactory.getLog(java.lang.String) took 100.996ms
com.amazonaws.demo.androidpubsub E/com.amazonaws.demo.androidpubsub.PubSubActivity: onError:
java.lang.RuntimeException: Failed to initialize Cognito Identity; please check your awsconfiguration.json
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:402)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalArgumentException: Failed to read CognitoIdentity please check your setup or awsconfiguration.json file
at com.amazonaws.auth.CognitoCredentialsProvider.getRegions(CognitoCredentialsProvider.java:195)
at com.amazonaws.auth.CognitoCredentialsProvider.(CognitoCredentialsProvider.java:174)
at com.amazonaws.auth.CognitoCachingCredentialsProvider.(CognitoCachingCredentialsProvider.java:228)
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:400)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101) 
at java.lang.Thread.run(Thread.java:764) 
Caused by: java.lang.IllegalArgumentException: Cannot create enum from Regions.US_EAST_1 value!
at com.amazonaws.regions.Regions.fromName(Regions.java:114)
at com.amazonaws.auth.CognitoCredentialsProvider.getRegions(CognitoCredentialsProvider.java:193)
at com.amazonaws.auth.CognitoCredentialsProvider.(CognitoCredentialsProvider.java:174) 
at com.amazonaws.auth.CognitoCachingCredentialsProvider.(CognitoCachingCredentialsProvider.java:228) 
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:400) 
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101) 
at java.lang.Thread.run(Thread.java:764) 

Seems that the AWS modules do not work in the App.

How to deal with this problem?
Should there some other code be added?

desokroshan and others added 3 commits December 26, 2018 10:56
@frankmuellr
Copy link

Hi @iwwork@, sorry you are running into issues using our PubSub sample app. I've opened the following issue in the AWS Android SDK repo, and will close this PR, since it's really just an issue.
aws-amplify/aws-sdk-android#719

Please watch the issue for updates.

@palpatim palpatim deleted the pubSubUpdate branch June 13, 2019 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants