AWS IoT login from android MQTT client using IAM is not working

0 votes

I have been trying to connect my android application to AWS IoT portal. I have created an IAM account, which has a username and password. I have gone through the documentation but I could not see any proper guideline. I read somewhere that I can access the IoT devices through IAM/Cognito/using a certificate. Since I am an Android user I can't(I don't want to) use a device certificate. Can I use my IAM credentials to access my AWS IoT devices? I have downloaded all sample application and I could not find any working code. Or could someone explain how can I access AWS IoT portal from android app?

Jul 24, 2018 in IoT (Internet of Things) by Matt
• 2,270 points
2,294 views

1 answer to this question.

0 votes

Seeing your comments and questions. I had the similar issues when working with AndroidPubSubWebSocket. Make sure you are giving appropriate permission to publish and subscribe to the thing as given in the Github repo instruction by AWS. Assuming that has been done.

  1. The sample provided in the Github AndroidPubSuB is only for the unauthenticated user. For authenticated user (Here Facebook) few things have to be added both on AWS side and Android Side

Android

Map<String, String> logins = new HashMap<String, String>();
        logins.put("graph.facebook.com", AccessToken.getCurrentAccessToken().getToken());
        credentialsProvider.setLogins(logins);

The above code is necessary as it is used by AwsCredentialProvider for authentication of the user for publishing and connecting to the thing.

After you are done with above head here. Follow the answer by Caleb and do the exact steps.

After this, you are good to go.

  1. For Unauthenticated user create a pool for users and region in AWS. Get the thing end point. Make the appropriate changes.

To get the changes to the shadow type the following in the sample android(WebSocketAwsOubSub) edit box $aws/things/thing_name/shadow/update/accepted

And to publish the data to the shadow type $aws/things/thing_name/shadow/update

answered Jul 24, 2018 by anonymous2
• 4,280 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

The MQTT folder is missing in Bluemix IoT NodeJS code,

IoT-Workbench now uses new improved code generation ...READ MORE

answered Aug 8, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
901 views
0 votes
1 answer

Testing if messages from my Device is reaching the Azure IoT Hub?

Download the Device Explorer open source tool ...READ MORE

answered Aug 10, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
3,777 views
0 votes
1 answer
0 votes
1 answer

aws iot describe-endpoint::You must specify a region

This fixed the problem: Browse to https://console.aws.amazon.com/iam/home?region=us-west-2#security_credentialand then if ...READ MORE

answered Jul 11, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,200 views
0 votes
1 answer

Publishing commands to device in IBM IoT using MQTT in Java

If you are publishing from an application, ...READ MORE

answered Jul 27, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,461 views
0 votes
1 answer

Send data from cloud to aws iot thing

Your solution is not recommend because there ...READ MORE

answered Aug 2, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,356 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP