Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

fix: Fixed crash while sending forms through hotspot #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,29 +373,31 @@ private void startSending() {

@RequiresApi(api = Build.VERSION_CODES.O)
private void turnOnHotspot() {
WifiManager manager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
manager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback() {

@Override
public void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) {
super.onStarted(reservation);
hotspotReservation = reservation;
currentConfig = reservation.getWifiConfiguration();
startSending();
}
if (!isHotspotInitiated) {
WifiManager manager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
manager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback() {

@Override
public void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) {
super.onStarted(reservation);
hotspotReservation = reservation;
currentConfig = reservation.getWifiConfiguration();
startSending();
}

@Override
public void onStopped() {
super.onStopped();
Timber.d("Local Hotspot Stopped");
}
@Override
public void onStopped() {
super.onStopped();
Timber.d("Local Hotspot Stopped");
}

@Override
public void onFailed(int reason) {
super.onFailed(reason);
Timber.d("Local Hotspot failed to start");
}
}, new Handler());
@Override
public void onFailed(int reason) {
super.onFailed(reason);
Timber.d("Local Hotspot failed to start");
}
}, new Handler());
}
}

@RequiresApi(api = Build.VERSION_CODES.O)
Expand Down