Skip to content

Releases: squadded/public-android-sdk

v0.1.0

24 Oct 10:27
28115c9
Compare
Choose a tag to compare
v0.1.0 Pre-release
Pre-release

ec6f5a61dc88e8a441bcdb391b2b33d1aa59bf9e

Singleton

The co.squadded.sdk.SquaddedSDK object is a singleton which you must initialize once with:

static init(String merchantId, String siteUrl, String siteTitle)

  • merchantId : your ID which was assigned to you by Squadded
  • siteUrl : the root URL of your merchant site
  • siteTitle : the short description of your brand or site, which you wish to be used in the Share actions

Instance

You may obtain the singleton instance with static SquaddedSDK.getInstance().

Display/Close the widget

You can pull open the Squadded Widget screen, by calling openWidget(ViewGroup root) :

  • root: the parent ViewGroup into which the screen will be added.

You may close the widget programmatically by invoking close().
Typically, you should monitor for the Back action and close the Widget accordingly, in order to offer a seamless user experience.

Add an item to Wishlist

You can programmatically request to send an article to the Squadded Wishlist, by calling addToWishlist(ViewGroup root, Item item):

  • ViewGroup root : the parent container for the widget, in case it is not already open.

  • Item item : an instance of co.squadded.sdk.SquaddedSDK.Item containing the following properties:

    • String itemId : the unique ID of your article in your own database
    • String currency : the textual symbol to use as the currency (eg. $, EUR, etc.)
    • String img : the URL of the article's image in your Website
    • String title : the name/title/description of the product
    • String url : the URL of the product page, in your Website
    • int price : the price after discount, multiplied by 100 (eg: $9.99 will be expressed as (int) 999
    • int origPrice : the price before discount, multiplied by 100.

Listeners

You can be informed when a user taps on a product inside the Widget, by registering this handler:
setOnViewProduct(OnViewProduct onViewProduct) :

  • co.squadded.sdk.SquaddedSDK.OnViewProduct onViewProduct : the callback, according to this interface:

    • void onViewProduct(String productId, String url)

where :

  • String productId : your own item ID
  • String url : the URL of the product's page in your own site