Testing Bluetooth Without Another Phone?

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Testing Bluetooth Without Another Phone?

Postby By60 » Thu Aug 12, 2010 4:24 am

Hi, I'm working on a multiplayer game that can be played between two Android phones over Bluetooth. Trouble is, I don't have another Android phone/device to test and develop my application on. I'm not so quick as to drop $400+ to buy an Android phone yet. I was wondering if any of you guys have any ideas on how I can approach this. My main disappointment is that the Android emulator doesn't support Bluetooth. Thanks a lot.
By60
Developer
Developer
 
Posts: 32
Joined: Sat Feb 06, 2010 7:00 am

Top

Re: Testing Bluetooth Without Another Phone?

Postby blundell » Thu Aug 12, 2010 11:05 am

You could try this, posted over at stack overflow:


Hi, as far as I know there is no support in the emulator for bluetooth. And I will have to teach android and bluetooth in some classes. And the students will need to code stuff and test (guess it) in the android emulator.

So I came up with a bare-bone reimplementation of the android bluetooth API on top of tcp. Find it on GitHub

Basically, you run a tcp-server on your machine, and the emulators will connect through it. Instead of using the classes in the package android.bluetooth, you just need to use the classes in the package dk.itu.android.bluetooth (and other 2 little modifies).

As for now it supports:

switch on/off the "radio"
discovery devices (only other android emulators)
creating bluetooth services
connecting to bluetooth services
It's not much, but until we got some more from the android guys, I guess there is nothing else around.

Hope it'll be useful, cheers!

____________________________________________________

Apart from that borrow a friends Android device?
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Testing Bluetooth Without Another Phone?

Postby By60 » Fri Aug 13, 2010 7:46 am

Hmm, sounds a little more complicated than I had expected, but I'll look into it. By the way, do you (or anyone else) know if there is a minimum API level for using Bluetooth chat (like the example provided in the SDK). I realized that, while I was creating a new app with the API level of 4, some of the imports wouldn't work until I changed it to API 6 (I don't have API 5). Thanks!
By60
Developer
Developer
 
Posts: 32
Joined: Sat Feb 06, 2010 7:00 am

Re: Testing Bluetooth Without Another Phone?

Postby blundell » Fri Aug 13, 2010 2:18 pm

Just found this Sample Bluetooth chat app:
http://developer.android.com/resources/ ... index.html

and google themselves have a minSDk of 6 "<uses-sdk minSdkVersion="6" />"

If you want to implement it for API 4 though you would have to be careful what method's you use.

Run through the api checking the method level:
Bluetooth cancelDiscovery See in the top right bar of that method in the link, it tells you what API level it is for
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Testing Bluetooth Without Another Phone?

Postby By60 » Sat Aug 14, 2010 2:08 am

Yea it looks to me like some of those crucial methods can only be called over API 5 (aka Android 2.0). One of the features of my apps is using this Bluetooth service, but this app can run perfectly without it. So if I implement this API level, does that mean people with phones running anything less than Android 2.0 can't download and install it? I have a phone that runs 2.2 that I'm testing everything on, so I don't know whether lower OS phones are affected.
By60
Developer
Developer
 
Posts: 32
Joined: Sat Feb 06, 2010 7:00 am

Re: Testing Bluetooth Without Another Phone?

Postby blundell » Sat Aug 14, 2010 12:54 pm

Yes whatever you set your "<uses-sdk minSdkVersion="?" />" will be the lowest Android OS that can see your app.
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 5 guests