-
-
Save LeonidIvankin/826c55c63d72cc802b6ca1264028a449 to your computer and use it in GitHub Desktop.
Sample FMP for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.leonidivankin.samplefmp; | |
import androidx.appcompat.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.util.Log; | |
import android.view.View; | |
import com.mobrun.plugin.api.HyperHive; | |
import com.mobrun.plugin.api.HyperHiveState; | |
import com.mobrun.plugin.api.VersionAPI; | |
import com.mobrun.plugin.api.callparams.TableStreamCallParams; | |
import com.mobrun.plugin.models.BaseStatus; | |
public class MainActivity extends AppCompatActivity { | |
private static final String TAG = "MainActivity"; | |
private static final String MY_URL = "http://mobilefmp.dev.fs.world"; | |
private static final VersionAPI MY_VERSION_API = VersionAPI.V_1; | |
private static final String MY_ENVIRONMENT = "Leonid_environment"; | |
private static final String MY_PROJECT = "Leonid_project"; | |
private static final String MY_VERSION = "v1"; | |
private static final String MY_LOGIN = "Leonid"; | |
private static final String MY_PASSWORD = "123123"; | |
private static final String MY_RESOURCE = "fruits_get_by_color_for_android"; | |
private HyperHive hyperHive; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
hyperHive = new HyperHiveState(getApplicationContext()) | |
.setHostWithSchema(MY_URL) | |
.setApiVersion(MY_VERSION_API) | |
.setEnvironmentSlug(MY_ENVIRONMENT) | |
.setProjectSlug(MY_PROJECT) | |
.setVersionProject(MY_VERSION) | |
.buildHyperHive(); | |
authentication(); | |
} | |
public void authentication() { | |
boolean status = hyperHive.authAPI.auth(MY_LOGIN, MY_PASSWORD, true).execute().isOk(); | |
Log.d(TAG, "authentication: " + status); | |
} | |
public void tableStream(View view) { | |
TableStreamCallParams tableStreamCallParams = new TableStreamCallParams(); | |
String data = "{\"fruit_color\": \"yellow\"}"; | |
tableStreamCallParams.setData(data); | |
String status = hyperHive.requestAPI.tableStream(MY_RESOURCE, tableStreamCallParams).execute(); | |
Log.d(TAG, "tableStream: " + status); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment