跳轉至

Android

這些是安裝Hive SDK後要執行的任務指示。

設置 Android 活動生命週期

安裝 Hive SDK 後,設置 Android 活動生命週期。在 MainActivity 中,調用以下代碼以匹配 Android 活動生命週期

@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);
}