APManager is a library that help to create mobile hotspot on android device programmatically , without taking care of android version and permission requires to do the same.It supports android 5.0 and later android version.
allprojects {
repositories {
...
jcenter()
}
}
dependencies {
implementation 'com.vkpapps.wifimanager:APManager:1.0.0'
}
APManager apManager = APManager.getApManager(this);
apManager.turnOnHotspot(this, new APManager.OnSuccessListener() {
@Override
public void onSuccess(String ssid, String password) {
//write your logic
}
}, new APManager.OnFailureListener() {
@Override
public void onFailure(int failureCode, @Nullable Exception e) {
//handle error like give access to location permission,write system setting permission,
//disconnect wifi,turn off already created hotspot,enable GPS provider
//or use DefaultFailureListener class to handle automatically
}
});
//use this line to turn off Hotspot
//apManager.disableWifiAp();
APManager apManager = APManager.getApManager(this);
apManager.turnOnHotspot(this,
new APManager.OnSuccessListener() {
@Override
public void onSuccess(@NonNull String ssid, @NonNull String password) {
//write your logic
}
},
new DefaultFailureListener(this)
);
//use this line to turn off Hotspot
//apManager.disableWifiAp();
Apache License
Copyright (c) 2020 Vijay Patidar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.