Add delay before start server dialog for devices < O

This commit is contained in:
Adeel Zafar 2019-07-26 17:45:56 +05:00
parent 2e0da70bf4
commit eefeaed069
2 changed files with 16 additions and 11 deletions

View File

@ -64,14 +64,6 @@ public class HotspotService extends Service {
switch (intent.getAction()) {
case ACTION_TURN_ON_BEFORE_O:
if (hotspotManager.setWifiEnabled(null, true)) {
//final Handler handler = new Handler();
//handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// startServerDialog();
// }
//}, 6000);
startHotspotDetails();
updateNotification(getString(R.string.hotspot_running), true);
}

View File

@ -154,9 +154,22 @@ public class WifiHotspotManager {
AlertDialog.Builder builder = new AlertDialog.Builder(context, dialogStyle());
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
startServerDialog(context);
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
startServerDialog(context);
});
} else {
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startServerDialog(context);
}
}, 6000);
});
}
builder.setTitle(context.getString(R.string.hotspot_turned_on));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setMessage(