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?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
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.
Android
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.
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
The sample application has some constant that you would need to replace with your own values, such as the cognito pool Id, your IoT endpoint. In IAM you would also need to give proper IoT permissions so that you app may connect to IoT and do publish/subscribes. Which sample application are you having issue using ? And at which particular step do you have questions?
Thanks.