Help > Manuals > GuruWear for Android API

GuruWear for Android API




We plan to upgrade API to address various user needs.
If you want to implement different scenarios, not covered by current API version, please let us know. We will be happy to assists you and to upgrade API to address new ideas.

Choose formula

Choose formula from all installed formulas. Can be started on mobile or directly on wearable.

Intent actoion: net.guruwear.PICK_FORMULA
Available for: mobile, wearable
Extras: none
Result extra:

  • net.guruwear.FORMULA_ID (string) Formula identifier
  • net.guruwear.FORMULA_NAME (string) Formula name
  • net.guruwear.FORMULA_DESCRIPTION (string) Formula description
  • net.guruwear.FORMULA_CATEGORY (string) Formula category

Sample code:

private static final int PICK_FORMULA_REQUEST = 325;

String mFormulaId;
String mFormulaName;

/**
 * 
 * open formula choose activity
 *
 */
public void pickFormula()
{
    Intent i = new Intent();
    i.setAction("net.guruwear.PICK_FORMULA");
    startActivityForResult(i, PICK_FORMULA_REQUEST);
}

/**
 * 
 * Get results
 *
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == PICK_FORMULA_REQUEST) {

        if (resultCode == RESULT_OK) {

            mFormulaId = data.getStringExtra("net.guruwear.FORMULA_ID");
            mFormulaName = data.getStringExtra("net.guruwear.FORMULA_NAME");

            //saveData();

        } else {

            mFormulaId = "";
            mFormulaName = "";

            //saveData();

        }
    }
}

Choose formula category wearable screen Choose formula wearable screen

Choose formula mobile screen

Start formula

Start specified formula on Android Wear watch. Can be started from mobile or directly on wearable device.

Intent action: net.guruwear.RUN_FORMULA
Available for: mobile, wearable
Extras:

  • net.guruwear.FORMULA_ID (string, required)
  • net.guruwear.PROGRESS_OPTION (integer, optional) - determine how to deal with saved formula progress
    Values:
    • 0 (Progress ask) – ask to continue or restart formula with saved progress
    • 1 (Progress load) – load saved progress if available
    • 2 (Prograss discard) – discard saved progress if any and start formula from the beginning

Sample code:

Intent i = new Intent();
i.setAction("net.guruwear.RUN_FORMULA");
i.putExtra("net.guruwear.FORMULA_ID", myFormulaID);

if (i.resolveActivity(getPackageManager())!=null) startActivity(i);