'Using AWS SDK to help call and allow a user create a tracker API in JavaScript?
Solution 1:[1]
A few initial thoughts based on the code snippet you shared:
- I don't know enough about your use case, you wouldn't need to have more than one tracker per asset type when tracking moving objects. If that's the case for you, create trackers using AWS CLI or AWS Console.
- If you'd like to create trackers using the JavaScript SDK, first, you need to authenticate your request. See Prerequisites for using Amazon Location Service and Geofencing and Tracking to get more information.
- Check your input parameters (
params
) against the CreateTracker API requirements and make sure you're using the right parameters and passing the right values. - Check your browser's console and post the errors you're getting here to help me better understand the issue.
- Note that
createTracker
creates a new tracker that does not have any data - this means that there is nothing to render yet. To track your assets, you'll need to send position updates to the tracker. See Start Tracking for an example.
Share a bit more about your use case, i.e., what is it you're trying to do. That'll help me better understand the problem.
UPDATE: here is what I'd do for your use case:
- Create a tracker using AWS Console or AWS CLI.
- Use AWS Amplify to push position updates to the tracker when building iOS or Android apps.
- Use AWS IoT Core to send position updates to the tracker when building something else like a web app. See Tracking using MQTT with Amazon Location Service for an example. I'd consider AWS Amplify PubSub to send/receive messages to AWS IoT Core when building on the web.
- Send metadata like the name of the food truck, food type, etc. along with position updates using
PositionProperties
- see Update your tracker with a device position. This would help me attach more information for data visualization or analysis purposes.
Hope this helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |