Requests to mobile platform server are exchanged using the HyperHive main class. When a class instance is created, initialization project parameters are specified via the HyperHiveState auxiliary class.
The example of initializing HyperHive in the Application class:
Add a permissions to access internet in the manifest file:
<uses-permission android:name = "android.permission.INTERNET"/>
Create the Application class to initialize framework on initializing application in the "app" new package:
public class App extends Application {
@Override
public void onCreate() {
}
}
Connect the Application class in the manifest file:
<application android:name = ".app.App"/>
Set parameters and initialize the framework:
public class App extends Application {
private static HyperHive hyperHive;
@Override
public void onCreate() {
super.onCreate();
// Set parameters to work with HyperHive
HyperHiveState hyperHiveState = new HyperHiveState(appContext)
.setHostWithSchema("http://test.sp.fsight.com")
.setApiVersion("v0.6")
.setEnvironmentSlug("test_environment")
.setProjectSlug("project")
.setVersionProject("v1");
// Create a handler in UI stream to send data from other streams to it
Handler uiHandler = new Handler();
// Set up default handler
hyperHiveState.setHandler(uiHandler);
// Create an object of the HyperHive class based on specified parameters
hyperHive = hyperHiveState.buildHyperHive();
}
// Static method to get hyperHive
public static HyperHive hyperHive() {
return hyperHive;
}
// Static method to get handler to be executed in UI stream
public static Handler uiHandler() {
return uiHandler;
}
}
IMPORTANT. Specify all mandatory parameters, otherwise framework initialization returns a message about missing mandatory parameter.
After initialization execute authentication on mobile platform server using the auth or authWithChangePassword method.
For details about Android framework methods see the Describing Android Framework Methods section.
To view examples of Android framework use, see the Examples of Android Framework Use section.
See also:
Android Framework | Describing Android Framework Methods | Examples of Android Framework Use