How to use custom fields with the FMS 2.0? 06/18/2018

Custom fields

The feature allows you to display five custom fields related to your business use case from one of the application.

We provide a library (FamocoCustomFieldsLib.aar) allowing 1 application to add fields (key: value) on FMS for your devices.

Library source: famococustomfieldslib on Stash

Pre-requisite: Famoco Layer version 1.27

How to import Library into an existing project :

* Drop the famocoCustomFieldsLib.aar inside the libs folder of the project app module.
* Edit app’s module’s build.gradle to include and compile the library with the project.

Build.gradle

allprojects {

repositories {

jcenter()

flatDir {

dirs ‘libs’

}

}

}

dependencies {


compile(name:’famocoCustomFieldsLib’, ext:’aar’)

}

* Clean and rebuild.

How to use?

Inside Activity

  1. Initial Setup:

FamocoFieldsEditor

FamocoFieldsEditor mFamocoFieldsEditor;

mFamocoFieldsEditor =

FamocoFieldsEditor.getInstance(this);

  1. Register Callback :

Callbacks

@Overridepublic

void onStart() {

   …

mFamocoFieldsEditor.registerForUpdate(this);  // registerForUpdate(Context context)

}

@Overridepublic

void onPause() {

   …

mFamocoFieldsEditor.unRegisterUpdate(this); // unRegisterUpdate(Context context)

}

 

  1. AddKeyValue and SyncWithFMS

Usage

// add key to the sync list

mFamocoFieldsEditor.addKeyValue(key,value);   // addKeyValue(String, String)

mFamocoFieldsEditor.removeKey(key);              // removeKey(String) //

set your own request_id, and ask for a sync when you are done adding all your Key-Value

mFamocoFieldsEditor.syncWithFMS(this,MY_REQUEST_CODE);   // syncWithFMS(Context, Int request_id)

  1. Response via IFMSCallback interface:

Responses

public class ActivityTest extends Activity implements IFMSCallback {

   …

@Override

public void FMSOpsOk() {

         …

}

@Override

public void FMSOpsFailed() {

         …

}

}

 

Need any help using this feature? Contact our lovely support team by email (support@famoco.com) or directly by chat from your FMS account.

Subscribe to our NEWSLETTER !
  • This field is for validation purposes and should be left unchanged.

Téléchargez la fiche produit

    Get more information by reading our privacy policy.
  • Hidden
  • This field is for validation purposes and should be left unchanged.