Gaurav Shukla
Gaurav Shukla

Reputation: 1284

update android device (or thing) application code by aws services


I have a requirement in my aws IoT project in which I need to udpate aws IoT connected device's application code or some part of it, let's say, application version or application schedule updation etc.
How should I achieve this ? so far I could found cloud front or code deploy useful but not directly used for such purposes. Any other service would help me in achieving the required solution available in aws ?
Thanks.

Upvotes: 1

Views: 322

Answers (2)

Halim Qarroum
Halim Qarroum

Reputation: 14103

Firmware upgrade on all devices

A reasonable pattern would be to use the Device Shadow in AWS IoT to store in the reported state, the current firmware information of your device.

{
  "reported": {
    "firmware": {
      "version": "1.0.0",
      "name": "linux-3.8.0-armeabi"
    }
  }
}

When you want to trigger a firmware upgrade on your devices, you can reference the new version, and a pointer to it (to an S3 bucket for instance) in the desired state.

{
  "reported": {
    "firmware": {
      "version": "1.0.0",
      "name": "linux-3.8.0-armeabi"
    }
  },
  "desired": {
    "firmware": {
      "version": "1.1.0",
      "name": "linux-4.0.0-armeabi",
      "url": "https://s3-<region>.amazonaws.com/<bucket>/<file>"
    }
  }
}

When this change will occur, the device will receive a delta event, indicating a change in its shadow document, and will start downloading the new firmware once he'll notice that a new firmware entry is described in the desired state.

Note: One advantage of this method is that it will work even if the devices are offline, when they'll get back online, they will sync with the shadow.

Selective firmware upgrade

Sometimes, manufacturers want to control the way firmwares are being deployed on their device fleet, for example they may want to:

  • Deploy different firmwares for different regions in the world.
  • Deploy different firmwares for devices having slightly different hardware.
  • Deploy different firmwares for devices they have sold to different manufacturers (B2B2C).
  • Deploy a firmware progressively across different regions, and not at the same time.

To take these contraints into account if you want to fine-grain your deployment, you can use the above method coupled to the use of Things Attributes in the Device Registry, so that when you are going to update the desired state, you will do so by only selecting the devices matching predefined attributes.

Upvotes: 1

Ali
Ali

Reputation: 434

If you are using an android device then you can use an AsyncTask to fetch the latest from an S3 bucket and call the post download method to install the apk refer the answer @ the link

https://stackoverflow.com/a/15213350/7328096

Upvotes: 1

Related Questions