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
-
Initial Setup:
FamocoFieldsEditor
FamocoFieldsEditor mFamocoFieldsEditor;
mFamocoFieldsEditor =
FamocoFieldsEditor.getInstance(this);
-
Register Callback :
Callbacks
@Overridepublic
void onStart() {
…
mFamocoFieldsEditor.registerForUpdate(this); // registerForUpdate(Context context)
}
@Overridepublic
void onPause() {
…
mFamocoFieldsEditor.unRegisterUpdate(this); // unRegisterUpdate(Context context)
}
-
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)
-
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 !