Skip to content

Android

These are the instructions for tasks to perform after installing the Hive SDK.

Set up Android activity lifecycle

After installing the Hive SDK, set up the Android activity lifecycle. In MainActivity, call the following code to match the Android activity lifecycle.

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
   HiveActivity.onCreate(this, savedInstanceState);
}
@Override
protected void onStart() {
  super.onStart();
   HiveActivity.onStart(this);
}
@Override
protected void onRestart() {
  super.onRestart();
   HiveActivity.onRestart(this);
}
@Override
protected void onResume() {
  super.onResume();
   HiveActivity.onResume(this);
}
@Override
protected void onPause() {
  HiveActivity.onPause(this);
   super.onPause();
}
@Override
protected void onStop() {
  HiveActivity.onStop(this);
   super.onStop();
}
@Override
protected void onDestroy() {
  HiveActivity.onDestroy(this);
   super.onDestroy();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
  super.onWindowFocusChanged(hasFocus);
   HiveActivity.onWindowFocusChanged(this, hasFocus);
}
@Override
protected void onNewIntent(Intent intent) {
  super.onNewIntent(intent);
   HiveActivity.onNewIntent(this, intent);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
   HiveActivity.onActivityResult(this, requestCode, resultCode, data);
}
// Android SDK 6.0 (android-23) API over
@TargetApi(23)
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   HiveActivity.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
}