mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 12:42:56 -04:00
Add logging to debug
This commit is contained in:
parent
c75296b2de
commit
51907ffd8c
@ -413,7 +413,6 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
wifiHotspotManager.showWritePermissionSettings();
|
||||
|
||||
serviceIntent = new Intent(this, HotspotService.class);
|
||||
|
||||
}
|
||||
|
||||
//End of onCreate
|
||||
@ -1128,13 +1127,13 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
private void toggleHotspot() {
|
||||
boolean check = false;
|
||||
//Check if location permissions are granted
|
||||
Log.v("DANG","Turn off -1");
|
||||
Log.v("DANG", "Turn off -1");
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
Log.v("DANG","Turn off 0");
|
||||
Log.v("DANG", "Turn off 0");
|
||||
if (wifiHotspotManager.checkHotspotState()) //If hotspot is already enabled, turn it off
|
||||
{
|
||||
Log.v("DANG","Turn off 1");
|
||||
Log.v("DANG", "Turn off 1");
|
||||
serviceIntent.setAction(ACTION_TURN_OFF_AFTER_O);
|
||||
getApplicationContext().startService(serviceIntent);
|
||||
//wifiHotspotManager.turnOffHotspot();
|
||||
|
@ -28,7 +28,7 @@ import static org.kiwix.kiwixmobile.utils.StyleUtils.dialogStyle;
|
||||
public class WifiHotspotManager {
|
||||
private WifiManager wifiManager;
|
||||
private Context context;
|
||||
private WifiManager.LocalOnlyHotspotReservation hotspotReservation;
|
||||
private WifiManager.LocalOnlyHotspotReservation hotspotReservation = null;
|
||||
private boolean oreoenabled = false;
|
||||
private WifiConfiguration currentConfig;
|
||||
|
||||
@ -78,7 +78,7 @@ public class WifiHotspotManager {
|
||||
public void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) {
|
||||
super.onStarted(reservation);
|
||||
hotspotReservation = reservation;
|
||||
currentConfig = reservation.getWifiConfiguration();
|
||||
currentConfig = hotspotReservation.getWifiConfiguration();
|
||||
|
||||
Log.v("DANG", "THE PASSWORD IS: "
|
||||
+ currentConfig.preSharedKey
|
||||
@ -108,24 +108,27 @@ public class WifiHotspotManager {
|
||||
//Workaround to turn off hotspot for Oreo versions
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public void turnOffHotspot() {
|
||||
Log.v("DANG","Turn off 4");
|
||||
Log.v("DANG", "Turn off 4");
|
||||
if (hotspotReservation != null) {
|
||||
hotspotReservation.close();
|
||||
hotspotReservation = null;
|
||||
oreoenabled = false;
|
||||
Log.v("DANG","Turned off hotspot");
|
||||
Log.v("DANG", "Turned off hotspot");
|
||||
}
|
||||
}
|
||||
|
||||
//This method checks the state of the hostpot for devices>=Oreo
|
||||
public boolean checkHotspotState() {
|
||||
if (hotspotReservation != null) {
|
||||
Log.v("DANG","I'm returning true");
|
||||
return true;
|
||||
} else {
|
||||
Log.v("DANG","I'm returning false");
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public boolean checkHotspotState() {
|
||||
//Log.v("DANG",(hotspotReservation.getWifiConfiguration()).SSID);
|
||||
if (hotspotReservation == null) {
|
||||
Log.v("DANG", "I'm returning false");
|
||||
return false;
|
||||
} else {
|
||||
Log.v("DANG", "I'm returning true");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +181,7 @@ public class WifiHotspotManager {
|
||||
|
||||
private void hotspotDetailsDialog() {
|
||||
|
||||
Log.v("DANG","Coming hotspot details dialog :4");
|
||||
Log.v("DANG", "Coming hotspot details dialog :4");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context, dialogStyle());
|
||||
|
||||
@ -192,7 +195,6 @@ public class WifiHotspotManager {
|
||||
R.string.hotspot_pass_label) + " " + currentConfig.preSharedKey);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
Log.v("DANG","Coming end of hotspot details dialog :5");
|
||||
|
||||
Log.v("DANG", "Coming end of hotspot details dialog :5");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user