We can programmatically turn on and off
setWifiApDisable.invoke(connectivityManager, TETHERING_WIFI);//Have to disable to enable
setwifiApEnabled.invoke(connectivityManager, TETHERING_WIFI, false, mSystemCallback,null);
Using callback class, to programmatically turn on hotspot in pie(9.0) u need to turn off programmatically and the switch on.