I am trying, without success, to pair a bluetooth device with a Android phone without asking to the user the PIN.
My idea is to fetch the desired PIN from a web service because the bluetooth device I want pair needs to be used from more people (and so for more android phones) without knowing and enter the PIN.
Do you have any idea for do it? I tried to see Bluetooth classes, but always, during device connection, I need to enter the PIN.
Thank you in advance!
You can use "just works" feature of Bluetooth pairing. This works only with SSP(secure simple pairing), from Bluetooth 2.1 onwards.
You have to set the IO capabilities of device for this to work.
Related
I made an app to turn my phone (LGV20) into a PC keyboard using Android Bluetooth. I'm trying to remove the PC server code by getting my app to pair my phone as a keyboard instead of a phone.
The only app I found that doesn't require a PC setup or rooting is Blek. It seems that when you turn the app on it tries to pair your phone as a keyboard like I want. However, I can't figure out how they did it. I imagine they did something like this:
public class MyBluetoothAdapter extends BluetoothAdapter {
private static final String DEVICE_PAIR_TYPE = "Keyboard"
...
}
That's not a real variable in BluetoothAdapter but I imagine something like this was used.
The hint should be when you looked at the app's description:
The receiver device must have Bluetooth 4.0 ....
So a search shows that among the many GATT specifications:
https://www.bluetooth.com/specifications/gatt
There is a HID over GATT profile
And it appears that each Bluetooth LE chip manufacturer has a keyboard HID over GATT example.
I suspect that each Bluetooth LE chip SDK has some JNI/C level type stuff to enable keyboard HID over GATT.
From this SO post: is there any ble api in Ndk
It looks like lower level Bluetooth access is available but invocation may vary on a chip to chip basis.
Given that Android allows for a number of different chip vendors, the author of the app you cite may have some of such SDK based code installed but may not work on all devices.
One open source(ish) implementation that I've found but not tested is:
https://github.com/kshoji/BLE-HID-Peripheral-for-Android
which appears to have a min SDK of 21. However the 'secret sauce' is still 'hidden' in an AAR in the author's lib directory.
So what else can be done?
Find out what Bluetooth Low Energy chipset your device uses. I don't have access to a LGV20 but perhaps something in the logcat will point to a manufacturer.
Once you know the manufacturer and chipset series, see if you can get access to that chipset makers particular Bluetooth Low Energy SDK for any sample code/modules which can enable HID over GATT.
Write app with such code/module with the understanding that you may need to deal with JNI/C.
This new restriction on Android 6.0. If the wifi you are connected to doesn't have internet access, it alerts you to choose whether you want to keep connected, and if you select no, or you don't make a selection, the phone will be disconnected, and get connected back to your 3G/4G or another wifi. For real world users, a lot of them won't even pay attention to that alert message. Is there a workaround to override this restriction? I need the wifi with no internet connection, and i do not want the users to have to deal with selecting whether they have to keep connected. Any help will be appreciated.
I want to make a app to count the number of mobile devices under the current Wifi Access Point.
But it seems there is no API for that.
Here's an example for you to get a list of connected clients to hotspot in Android: http://www.whitebyte.info/android/android-wifi-hotspot-manager-class
What Api have you tried ? you can try this https://code.google.com/p/iphone-wireless/wiki/Stumbler. You can see LINK here as well.
I am developing an Messaging application using J2ME for which i need to access the mobile number of a device on which application is running.
I tried to find out the api's related to it but was unable to find it.
So Plz can any one tell me is there any other method to find the mobile number in J2ME?
From what I know, that's impossible, not all J2ME devices are mobile phones and even if the device running J2ME is a mobile phone its not always aware of its phone number. There are some tips and tricks to accomplish this task eg. from a way for some Nokia devices (look here) by reading some system properties ('com.nokia.mid.msisdn') to some 'silly' ways of sending an sms to a specially prepared sms receiver/sender who just replies another sms, then your application can listen to incoming sms with a specific data and read its mobile number.
Well, I think it is possible--create a SIM applet that will extract the MSISDN from one of the Elementary Files (EF) of the SIM (I am not sure which one). Then, with SATSA, make the JME application communicate with the SIM applet.
I have an android devic, i wish to know when it is connected to the pc via java/.net
i know its possible - the Samsung New PC Studio is doing it, when ever i connect an android device it lets me know. how can i achieve the same?
You have to listen for one of this notifications
http://developer.android.com/reference/android/content/Intent.html
If you're using it as a mass storage device then use this
http://developer.android.com/reference/android/content/Intent.html#ACTION_UMS_CONNECTED
Other USB events aren't clearly described in the documentation
EDIT:
If you want to read on the computer side I would read this article
http://today.java.net/article/2006/07/05/java-and-usb
and then check which kind of devices are connected to the usb port. if it is a mobile phone, then you can try to send a short message to it. on your phone you make a small piece of code which returns an appropriate answer so you can detect thats its really android/your phone/this phones you want to identify
java device detection
This site have a guide on how to detect device with java web and java core
http://51degrees.com/Support/Documentation/Java/GettingStarted.aspx