Skip to content

Commit

Permalink
Merge pull request #176 from inoshperera/master
Browse files Browse the repository at this point in the history
Root detection for Android
  • Loading branch information
inoshperera committed May 21, 2018
2 parents 09f1c4b + aac2c2c commit 88ea71d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
targetSdkVersion 25
multiDexEnabled true

versionCode 3010032
versionName "3.1.32"
versionCode 3010033
versionName "3.1.33"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package org.wso2.iot.agent.activities;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
Expand All @@ -31,6 +33,7 @@
import org.wso2.iot.agent.R;
import org.wso2.iot.agent.api.DeviceState;
import org.wso2.iot.agent.services.EnrollmentService;
import org.wso2.iot.agent.utils.CommonDialogUtils;
import org.wso2.iot.agent.utils.Constants;
import org.wso2.iot.agent.utils.Preference;
import org.wso2.iot.agent.utils.Response;
Expand Down Expand Up @@ -72,10 +75,29 @@ protected void onCreate(Bundle savedInstanceState) {
decorView.setSystemUiVisibility(uiOptions);
/* New Handler to start the WorkProfileSelectionActivity
* and close this Splash-Screen after some seconds.*/
DeviceState state = new DeviceState(this);
final Response deviceCompatibility = state.evaluateCompatibility();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity();
if (deviceCompatibility.equals(Response.COMPATIBLE)) {
startActivity();
} else {
AlertDialog.Builder builder = CommonDialogUtils
.getAlertDialogWithOneButton(SplashActivity.this,
SplashActivity.this.getResources()
.getString(deviceCompatibility.getDescriptionResourceID()),
SplashActivity.this.getResources()
.getString(R.string.button_ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
SplashActivity.this.finish();
}
}
);
builder.show();
}
}
}, AUTO_HIDE_DELAY_MILLIS);
}
Expand Down

0 comments on commit 88ea71d

Please sign in to comment.