What does "virtual headset plug inserted" of Android emulator mean? - android-emulator

The official document says:
The Android Emulator doesn't include virtual hardware for the following:
Bluetooth
NFC
SD card insert/eject
Device-attached headphones
USB
However, the emulator has the following settings:
Could anyone shed some light on what these settings mean?
The following code returns false for the emulator:
getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE)

As the name suggests, turning on the "Virtual headset plug inserted" in the emulator will send a broadcast "action=android.intent.action.HEADSET_PLUG".
Set up a broadcastreceiver for action.HEADSET_PLUG to detect unplug/plug of wired headsets.

I was looking for a way to make Android think I have connected headphones but enabling Virtual headset plug inserted is not enough. Do do that you have to install Lesser AudioSwitch and set input device to headset
Only then getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE) will return true

Related

Xcode wireless debugging over iPhone's hotspot in the park [solved]

For me wireless debugging works flawlessly on my home Wi-Fi, but I always wanted to go in the park and have the freedom of developing applications without the cable, where my iPhone provides Internet via its hotspot.
It would be nice if Apple reconsiders the hotspot and allows wireless debugging and all the other useful features to work without the need of entering IP manually or looking for workarounds.
See my answer in the replay below:
Connect to iPhone's hotspot. Disconnect the USB cable. My iPhone is still visible under Devices because wireless debugging is enabled, but I cannot run and debug applications. Control + click the iPhone, and select: Connect via IP: 172.20.10.1 Done! Now it just works.
Thanks to eskimo's advice

Can we check the device to be smartphone by using bluetooth in flutter?

The issue is when my flutter app is in bluetooth scanning mode it is detecting all the devices so i need only smartphone to detect using my app and other devices like smarTv,smartwatch and bands and headphones i need to reject them in my flutter app
Unfortunately there isn't a way to conclusively detect only smartphones and display them. When advertising with BLE, many devices use the "GAP Appearance" flag to specify their type (e.g. phone, computer, tag, clock, etc), but not all devices follow this convention, and many devices don't use this tag, so you are bound to display devices that are not smartphones.
For more information, have a look at the following links:-
How Bluetooth Low Energy Works: Advertisement
BLE Specification Generic Access Profile
BLE Specification GAP Appearance
I hope this helps.

flutter_blue shows mac address instead of Names

I am running flutter_blue example,it doesn't raise any error but after searching for bluetooth devices it shows mac address instead of Local Names.alse after clicking on connect it doesn't connect.
I did make sure that other devices are ble support, even I purchased Bluetooth v4.0 usb dongle to be completely sure about Bluetooth version, but nothing changed.
also, I thought it may be related to my android phone,I reset(factory) the phone and wiped cache but nothing changed.
my cellphone is Sony Xperia Z3+ with android 7.1.1;
any Idea what is wrong and why I can't get devices name in scan?
It was gattserver, couldn't broadcast properly,I changed gattServer with another app in another smartphone and now it shows the Name of GattServer.

More Input Methods for Google Card board VR World on Android?

Is there any hardware available by which we can get more control in VR world on Android in addition to Magnet Card board button?
For example some bluetooth joystick/Remote/mouse or any other way to use other android device as Input Source.
Kindly share if somebody tried.
There are many input devices compatibile with android.
The most basic controls are traditional keyboards or game pads plugged in via an OTG cable. This is also the cheapest option, and easiest to obtain for the consumer.
There are also bluetooth pads compatibile with android.
You can also try to use Wiimotes, but the support and libraries arent really that mature, at least among those that I tried.

Simulate iBeacon region enter and exit by turning bluetooth on and off

When I am testing with beacon emulator I can turn bluetooth on and off to simulate a user enter and exit the beacon area. However this is not possible when testing with real beacons since there are no switches to enable or disable them. Therefore, is it possible to simulate this by turning bluetooth on and off in the actual iphone? Is the result the same? Does turning on bluetooth result in an immediate bluetooth scan by iOS?
You can use your mac to generate ibeacons if it have bluetooth 4.0 (https://github.com/mttrb/BeaconOSX) and with that project you can enable or disable the virtual beacon. You can also use another idevice to generate a ibeacon signal.