mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 20:24:03 -04:00
Fix HotspotService force finished on clicking stop server
This commit is contained in:
parent
0928d9c625
commit
681742fdb5
@ -23,7 +23,7 @@ public class WebServerHelper {
|
||||
public static boolean isStarted;
|
||||
int port;
|
||||
private CoordinatorLayout coordinatorLayout;
|
||||
ServerStateListener listener;
|
||||
static ServerStateListener listener;
|
||||
String TAG = WebServerHelper.this.getClass().getSimpleName();
|
||||
|
||||
public WebServerHelper(Context context) {
|
||||
@ -47,6 +47,7 @@ public class WebServerHelper {
|
||||
public static boolean stopAndroidWebServer() {
|
||||
if (isStarted ) {
|
||||
isStarted = false;
|
||||
listener.serverStopped();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -18,7 +18,6 @@ import androidx.core.app.NotificationCompat;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
import org.kiwix.kiwixmobile.main.MainActivity;
|
||||
import org.kiwix.kiwixmobile.utils.Constants;
|
||||
import org.kiwix.kiwixmobile.webserver.ServerStateListener;
|
||||
|
||||
import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_TURN_OFF_AFTER_O;
|
||||
import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_TURN_ON_AFTER_O;
|
||||
@ -31,12 +30,11 @@ import static org.kiwix.kiwixmobile.webserver.WebServerHelper.stopAndroidWebServ
|
||||
|
||||
public class HotspotService extends Service {
|
||||
private static final int HOTSPOT_NOTIFICATION_ID = 666;
|
||||
public static final String ACTION_STOP = "hotspot_stop";
|
||||
public static WifiHotspotManager hotspotManager;
|
||||
private static final String ACTION_STOP = "hotspot_stop";
|
||||
private static WifiHotspotManager hotspotManager;
|
||||
private BroadcastReceiver stopReceiver;
|
||||
private NotificationManager notificationManager;
|
||||
private NotificationCompat.Builder builder;
|
||||
ServerStateListener serverStateListener;
|
||||
String TAG = HotspotService.this.getClass().getSimpleName();
|
||||
|
||||
@Override public void onCreate() {
|
||||
@ -117,7 +115,6 @@ public class HotspotService extends Service {
|
||||
stopForeground(true);
|
||||
stopSelf();
|
||||
stopAndroidWebServer();
|
||||
serverStateListener.serverStopped();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user