The official AMBROSUS Android SDK (AMB-NET API)
Switch branches/tags
Nothing to show
Clone or download
Latest commit defa4e1 Jun 9, 2018
Permalink
Failed to load latest commit information.
ScanditSDK Initial Commit Jun 9, 2018
ambrosussdk Initial Commit Jun 9, 2018
app Initial Commit Jun 9, 2018
gradle/wrapper Initial Commit Jun 9, 2018
.gitignore Initial Commit Jun 9, 2018
README.md Initial Commit Jun 9, 2018
asset_code.png Initial Commit Jun 9, 2018
build.gradle Initial Commit Jun 9, 2018
gradle.properties Initial Commit Jun 9, 2018
gradlew Initial Commit Jun 9, 2018
gradlew.bat Initial Commit Jun 9, 2018
settings.gradle Initial Commit Jun 9, 2018

README.md

Ambrosus Android SDK

The Ambrosus Android SDK makes it easy for Android App Developers to get back data from the Ambrosus API (AMB-NET), and build their own interfaces for displaying Assets and Events.

The Ambrosus Android SDK is currently written in Kotlin. It's as well compatible with Java code and can be used in Java based Android projects.

Supports Android 5 and above Supports Java and Kotlin

Integration

To start using the SDK you should link the sdk project in your gradle file:

include ':ambrosussdk'

If you have copied the sdk in ambrosussdk folder.

You have to download and copy the sdk fodler in your project.

Overview

The SDK is composed of couple main files. It uses Retrofit-2 to handle the communication with Ambrosus API.

AMBModel.kt - is located in src/java/com/ambrosus/ambrosussdk/model folder. It defines the main classes which are storing the data retrieved from the API.

  • AMBModel - base class
  • AMBAsset - particular asset
  • AMBEvent - particular event

AMBDataStore.kt - is a class which implements a singleton pattern. It can be used to keep local cache of the fetched object.

AMBNetwork.kt - is located in src/java/com/ambrosus/ambrosussdk/network folder. The AMBNetwork class which is responsible to do communication with the backend.

AMBService.kt - is an interface which defines the endpoints that are available on the backend.

There is one utility file SectionFormatter.kt which defines Section a separate element that stores information and SectionFormatter which can convert the JSON from the server to a list of Sections.

Usage

To start using the Ambrosus SDK within a project you should import the specific classes

//TBD

To get back an asset from the API you can make a call like the following using an EAN8 code:

AMBNetwork.instance.requestAsset("data[identifiers.ean8]", "96385074", { 
//it is AMBAsset or null
})

or using the assetId

AMBNetwork.instance.requestAsset("0x74d3723909b15275791d1d0366c9627ee4c6e4f9982f31233d0dd6c054e5b664", { 
//it is AMBAsset or null
})

A single Asset in the Ambrosus SDK has many events associated with it. All events will be fetched for you and added to the asset.

There is no separate function which can be used to fetch only the events.

Sample Application (Ambrosus Viewer)

Ambrosus Viewer is an Android application that uses the Ambrosus API https://dev.ambrosus.com combined with scanning technology to allow users to scan a Bar Code, QR Code, [or other 1D or 2D symbology - in development] and get details about an item moving through a supply chain.

Learn about scanned item, origins and other details such as temperature, weight, creation date, and more. See a timeline detailing all things that happened to the asset from the date of its creation to it arriving in stores.

To use the scanner in the Ambrosus Viewer you need a Scandit API key, you can sign up for a 30 day trial here: https://ssl.scandit.com/customers/new?p=test

The key can be replaced inside the ViewerFragment.kt on line 245:

private const val sScanditSdkAppKey = "[YOUR SCANDIT KEY HERE]"

Supported OS & SDK Versions

  • Supports Android 5 and above devices which have BLE.
  • Requires Camera permission enabled in order to scan codes
  • Requires internet permission to send the data to the API.
  • Capable of scanning codes with the following symbologies:
  • UPCE, UPC12, EAN8, EAN13, CODE 39, CODE 128, ITF, QR, DATAMATRIX

Sample Symbologies

To see details about sample assets with the Ambrosus Viewer, scan any of the following codes from the app:

  EAN-8     EAN-13       QR    
  EAN-8 Sample   EAN-13 Sample   QR Sample  
Generic Asset Guernsey Cow       Ibuprofen Batch 200mg