logo
down
shadow

Can I disable Bluetooth or camera or wifi of android device and allow enabling only through my customized app?


Can I disable Bluetooth or camera or wifi of android device and allow enabling only through my customized app?

By : rake
Date : November 14 2020, 04:51 PM
it helps some times You need to implement BroadcastReceiver that listens to BluetoothAdapter.ACTION_STATE_CHANGED (link). It should disable it back and show some information about your lock to user.
code :
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();

        if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
            final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
                                                 BluetoothAdapter.ERROR);
            switch (state) {
            case BluetoothAdapter.STATE_OFF:
                //do nothing
                break;
            case BluetoothAdapter.STATE_TURNING_OFF:
                //do nothing
                break;
            case BluetoothAdapter.STATE_ON:
                //disable it
                break;
            case BluetoothAdapter.STATE_TURNING_ON:
                //do nothing
                break;
            }
        }
    }
};


Share : facebook icon twitter icon
Android: bluetooth, wifi, networkinfo with broadcast receiver not working in device/emulator

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

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

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?

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?

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.
Related Posts Related Posts :
  • Change Spinner DropDown width
  • Samsung Galaxy S4 Screen Size
  • Android text style missing light, medium, thin,
  • Android Studio gradle build failed for hello world app
  • Slide a layout up from bottom of screen
  • Play HTML5 video in iOS/Android native media player
  • How to rescale a bitmap file in android?
  • No view found for id 0x for fragment after rotation?
  • Define different themable styles to the same widget types
  • ProGuard not working in my app
  • FragmentTransaction from BaseAdapter
  • Connecting multiple devices in a Wifi Direct group
  • Why TabActivity is deprecated in android
  • How to capture low resolution picture using android camera
  • android preferenceactivity padding in landscape orientation
  • How can I store cookie in webview?
  • Passing variables from one activity to another
  • Create Multicolored Pie Chart in Android Studio
  • how to kill progress dialog in android
  • Show Error on the tip of the Edit Text Android
  • How do I use getWindowManager() by another java file
  • fetching images from gallery on android phones with internal storage
  • How to discover devices like Google TV and Nexus-Q using MediaRoute API on Android?
  • "Unfortunately your app stopped working"- Facebook Integration for Android
  • How to animate button in android?
  • Resource Not Found Exception in class without context or activity
  • Launching Android Netflix App And Passing Video Id
  • Making a Phone Call with a Number Extension
  • NullPointerException at BoringLayout.isBoring is anything but boring
  • java.lang.RuntimeException: Unable to get provider
  • Testing custom Views with Robolectric
  • tools:listheader doesn't work although tools:listitem does
  • oppo, vivo app kill notification not coming in android fcm
  • OnClick Method could not function correctly with if else statement
  • Best method to download image from url in Android
  • How can I open Drawer Layout moving all the view and not just slide over?
  • how to show profile pictures of friends in a list view?
  • Creating TimePickerDialog with custom style in Android
  • Android 2.3.6 support library v7 option menu is missing
  • need of vblank in Display subssytem
  • Android MP4 stream - Video cannot be played
  • FastAdapter: Undo button does not show up after swipe
  • What are reasons to pass getActivity as the LifecycleOwner to the LiveData's observe method in a fragment?
  • Implement Face Recognition in Android
  • Titanium studio cannot run "titanium" command in terminal
  • How to execute command line ffmpeg commands programatically in android?
  • Make Android List Items clickable with each item pointing to a different link
  • listview runs successfully, but nothing is display in emulator
  • How to zoom in a bitmap with high resolution?
  • Passing listView data through intent
  • Google map route direction show by arrows in android v2
  • how to start "uiautomator test run" from android code?
  • Proguard in Android Library
  • Alarm Clock from GIT - Gives error - Android
  • Mock injection using Mockito - Android
  • Get Bitmap from universal image loader
  • Unable to include custom font in android
  • Basics on using logcat in Android development
  • Android: Clear cache programmatically
  • Android: pass object without serialization
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org