Android: bluetooth, wifi, networkinfo with broadcast receiver not working in device/emulator
By : Rich LaCroix
Date : March 29 2020, 07:55 AM
may help you . Bluetooth and WiFi are not supported in emulator. You have to use a real device.
|
android disable WiFi and Bluetooth service build
By : Dala Romya
Date : March 29 2020, 07:55 AM
Hope this helps Im trying to develop service that starts by bootup receiver if the wifi or bluetooth is enabled automatically disable it. , In the manifest code :
<receiver android:name=".BootTimeServiceStarter" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
public class BootTimeServiceStarter extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
if (bluetooth.getState() == BluetoothAdapter.STATE_ON
|| bluetooth.getState() == BluetoothAdapter.STATE_TURNING_ON) {
bluetooth.disable();
}
WifiManager wifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
if (wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED
|| wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLING) {
wifiManager.setWifiEnabled(false);
}
}
}
|
Android disable/enable Wifi and Bluetooth permanently
By : wangwangstar
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Just 5 minutes more got me the on the right track... the problem with my approach above is, that i wait listen to turning off / on. It seems that if i disable the bluetooth while it is just turning on, it will just continue to turn on and stay on. So i have to wait until it is actually turned on and then disable it. In other words, i had to remove 8 characters and it works fine: code :
public void onReceive(final Context context, final Intent intent) {
// get new wifi state
final int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.STATE_ON);
final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// if enabling, check if thats okay
if (bluetoothState == BluetoothAdapter.STATE_ON && BT_FORCE_DISABLE) {
mBluetoothAdapter.disable();
} else
// if disabling, check if thats okay
if (bluetoothState == BluetoothAdapter.STATE_OFF && BT_FORCE_ENABLE) {
mBluetoothAdapter.enable();
}
}
|
how to turn off wifi,bluetooth,data,gps,and reduce disable brightness-voloms in android?
By : chenlb
Date : March 29 2020, 07:55 AM
this one helps. you can turn ON/OFF wifi,bluetooth,reduce display brightness-volume but you can't directly to for mobile data and gps. for those things you need to Manually push an intent. bluetooth, WiFi , brightness, Volume, GPS , mobile-data
|
Can an android device connect to a sony camera without wifi?
By : Gagan
Date : March 29 2020, 07:55 AM
Hope that helps Unfortunately, the Camera Remote API only works over WiFi, so there is no other way to control the camera.
|