To check mobile platform server accessibility, create the HyperHiveConnectionStatus application that uses the framework method:
Method name |
Brief description |
connectionStatus(String baseUrl, long callbackId) | The method checks mobile platform server accessibility. |
The HyperHiveConnectionStatus application includes one screen and a button:
«SERVER STATUS». Checking mobile platform server accessibility.
To view application work results, use the interactive example:
Click the SERVER STATUS button.
package ru.HyperHiveConnectionStatus.app2;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
import com.mobrun.plugin.api.HyperHive;
import com.mobrun.plugin.api.HyperHiveState;
import com.mobrun.plugin.api.VersionAPI;
public class ServerStatusActivity extends AppCompatActivity
{
private static final String TAG = ServerStatusActivity.class.getSimpleName();
private static final String URL = "http://testmasterfmp.fsight.cloud/";
private static final String ENVIRONMENT = "Leonid_environment";
private static final String PROJECT = "Leonid_project";
private static final String PROJECT_VER = "v1";
private static final VersionAPI API_VER = VersionAPI.V_1;
private Button btn;
private TextView text;
private HyperHive hhive;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_server_status);
btn = (Button) findViewById(R.id.activity_server_status_btn);
text = (TextView) findViewById(R.id.activity_server_status_text);
Handler ui_handler = new Handler();
hhive = new HyperHiveState(getApplicationContext())
.setHostWithSchema(URL)
.setHandler(ui_handler)
.setApiVersion(API_VER)
.setEnvironmentSlug(ENVIRONMENT)
.setProjectSlug(PROJECT)
.setVersionProject(PROJECT_VER)
.buildHyperHive();
btn.setOnClickListener(v -> connectionCheck());
}
private void connectionCheck()
{
Log.d(TAG, "connectionCheck()");
String result = hhive.requestAPI.connectionStatus();
text.setText(result);
Log.v(TAG, "connectionCheck() result: " + result);
}
See. also: