Will
This user hasn't shared any biographical information
Homepage: http://www.grey-area.info
Posts by Will
Android and Bluetooth
May 14th
I’ve been tinkering around with the Android SDK for a while and I find myself liking it more and more, despite the fact that the visual editor for views is still somewhat lacking. I even have an update ready for DroidPartridge! That is still being tested and the UI being ‘jazzed up’ a little more.
Anyway I was asked to write some code for Android to communicate with a bluetooth device that sends data via OBEX Push. Now the problem was despite Android apparently having the bluetooth profiles to support this, the device always signaled failure when trying to push a file over to the phone. The device has no user interface bar a set of LEDs and a machanism to cause vibrations (Wanted to say vibrator, but I couldn’t stop giggling)
Anyway, in Android you have to register a listening BluetoothServerSocket with the UUID (The Java GUID for you Microsoft people) of the service that you are listening for and an arbitrary name that is then put in to the local SDP database and used to compare with incoming connections. This is similar but slightly different to J2ME where you specify the address, what mode it will be operating in and it if times out, which is all taken care of by Android to avoid conflicts and instead, you just tell Android what to listen out for and pass you a BluetoothSocket back once a matching connection has been found.
mBluetoothAdapter.listenUsingRfcommWithServiceRecord(serviceName, uuidofService);
Now whilst the Android documentation is very good and in depth, it didn’t inform me or even point to a resource that specified which UUID I should use for listening for a particular protocol, so in this instance I was going to emulate OBEX over SPP (Serial Port Protocol/Profile) which meant listening for an incoming SPP connection.
I spent hours and hours running around in circles in Google’s search results reading the same thing mirrored over several sites (which was increasing the profanity by an order of magnitude each time I encountered a mirror site) until I eventually stumbled across the answer which would return a BluetoothSocket when a connection was attempted. I almost wept.
So to listen for incoming SPP connections on Android you need to specify the following UUID;
00001101-0000-1000-8000-00805F9B34FB
and the example snippet:
mBluetoothAdapter.listenUsingRfcommWithServiceRecord(serviceName, UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
So when you call the blocking method:
BluetoothSocket connection = mBluetoothServerSocket.accept();
you get a BluetoothSocket back and the thread continues! Awesome eh ? Time to break out the victory smoke ?
Sadly my troubles had only begun.
The BluetoothSocket provides a standard InputStream and OutputStream for IO operations with the device, the problem was that I could read the first x bytes, formulate a response and flush it through the OutputStream and then the device would stop sending data and abort the connection. Again, profanity increased by a large amount. I spent quite a significant amount of time stepping through the code watching variables, ensuring that the response was correct and I was specifying the correct length in the headers and skipping the appropriate number of bytes. (Whilst trying to make sure that the bluetooth connection didn’t time out from the remote device’s perspective, which I can say is no mean feat.) Still no joy.
The answer it seems was simple. For some really odd reason, my responses were not being formatted correctly as I was writing variables of types short and byte to the OutputStream which for some reason were causing problems for the device to continue sending data after the initial connect op codes were sent. Wrapping the input and output streams with their respective DataInputStream and DataOutputStream classes allowed me to use the writeByte() and writeShort() methods which seemed to have corrected the problem. The device would now no longer disconnect after sending my response back.
So anyway, those were my Android bluetooth woes in a nutshell, the UUID problem was the most heartbreaking as it would had been fairly simple if there was some documentation on which UUID was for a particular profile. Part of this post is for reference for this UUID in the event that someone else needs the information and doesn’t have to spend a long time looking for it. Enjoy!
Note: The mBluetoothAdapter is an instance of the BluetoothAdapter class which can be instantised by Android using the following documentation.
The problem with Google
May 3rd
Google as a company pledge to not be evil and are the largest and most popular search engine, encompassing the globe for search, e-mail and other cloud based applications. I’ve watched this company start from a relatively obscure search engine evolve into a giant in providing services for consumers. I myself am very much in bed with Google. They manage my mail, my calendar, I have their phone with their operating system that syncs my contacts and settings to them. I also subscribe to Latitude and Buzz, use their Google Docs, their website analytic services and their Checkout for both buying and selling. (I even use their web browser!)
So yes, for me, Google has become ubiquitous. They know where I am, who I talk to, what I say, where I live and my bank details. It’s a tremendous wealth of information and a tremendous amount of faith that I put in to this company as I allow them to encroach more and more into my life, attempting to make it better.
The problem with all this power (excuse the cliché) is that it also means they have a large amount of responsibility. Google has to assure it’s users that it can address any issue that it’s users experience in a timely manner and that it wont provide cookie cutter answers via e-mail and hope the user goes away and figures out the problem themselves. Which may I add is probably just as likely as the user tripping over the meaning of this universe whilst out for a brisk stroll in the countryside with their dog.
The point is, over the last month, I became an Android developer and paid for that privilege. I also set-up a Google Checkout Merchant account so that if I did produce revenue from the applications that I built in my own time, I could eventually access it and put it towards server costs. However, when setting up the account the Google Checkout site completely broke down and I sent numerous e-mails to their support team via their help pages. There is no phone support and no direct e-mail, just a generic inbox. I got a response 24 hours later stating that the problem was fixed. It was not. So more e-mails were sent.
I had a look at the Google Groups and found a couple of threads and commented and added the cookie cutter e-mails that I had received so far. Quite a substantial number of users complained of the same problem and the lack of decent Google technical support. Close to two days after the incident and after many more cookie cutter responses with no time-scale on a fix or even a hint at what the problem was, The Register picked up on people getting more than just annoyed in this article. A few hours after this appeared on the internet, the problem was fixed.
Now I provide customer support at work all the time ranging from application failure and bug reports to supporting end users on varying mobile handsets and handling digital pens. The thing that stinks with Google’s so called support is that it is so impersonal and as generic as possible.
What would had been better is firstly not to send templated e-mails to users. The information is rarely relevant and shows no context of the problem that the user was having. This also infuriates users and highlights that the customer support team are either ill equipped or just don’t want to know.
Second would be to publish a public announcement to let users know that there is a problem, they know about it and any information on cause and resolution time scale. Google did none of this until The Register took notice of the users, which in my mind is shameful customer support. Considering Google make money from Google Checkout transactions, they should be hang their heads in shame at this massive failure, that is the perfect example of how not to support customers and loose business.
Now, that happened well close to 2 months ago, however the reason for this post is because yet again I am stumped by Google’s not-so-fantastic support for the same product. In my case, I’ve been trying to verify my bank details and was sent a generic e-mail with a couple of links which looked like it was copied directly from their help site. I followed one set of instructions, this did not change the situation and I spend a good half an hour running round the not-so-helpful documentation running round in circles. The Google Groups has unanswered threads on this and were informed that only direct e-mails will enable Google to sort this problem out.
So I am awaiting another cookie cutter response back from Google. Sadly I am now left with the sinking feeling that now that I have become one with the hive mind that is Google, is this the shape of things to come when I encounter a problem ? For theirs and my own sake, I really hope not.
The Nexus One and Android
Mar 31st
I seem to be blogging quite a bit this month and I appear to have a lot to say!
Anyway, I took the plunge and forked out for a shiny new Nexus One from Google and bought the desktop dock so I could show off to my boss. After using it for two weeks I can only say that my experience so far has been blissful. However I will state that it has not been entirely perfect, with a few quirks along the way.
The phone feels well built with a very responsive AMOLED touch screen, which is also very nice to look at and it leaves my old Nokia E71 eating it’s dust when it comes to performance. The 1GHz Snapdragon Processor might have something to do with that.
The Android Operating system is very swish and fluid, using it is very simple however sometimes drilling down to the settings is a little tedious. When I set-up the phone, I entered my Google Account details and before I could finish a cigarette all my contacts, e-mail and calendar were synced with the phone and any updates on the handset would propagate back to Google. Awesome. Next I set-up Facebook which also synced with my contacts adding addresses, e-mail addresses and profile pictures. At this point I was having to calm myself down with the sheer amount of awesomeness that this phone was delivering.
I have yet to get the phone to crash, freeze or slow down even slightly and I sync my Google, Facebook, Twitter and my work information along with running games, weather and news widgets, there seems to be no end to what this phone can do. I have apps for going walking in the country, to augmented reality browsers to find things that I need and even an app to scan bar codes and purchase the item on ebay.
I did run in to a problem when I switched networks from three to O2. The short story for this was because three was:
- expensive
- provided terrible customer/technical support
- refused to allow me to send e-mail over their network without a ‘three’ proxy application. (They don’t have an android application, so no e-mail)
Anyway when my O2 SIM arrived, I popped it in the phone and found that the cell reception was utterly rubbish and the 3G connectivity non existant. I had activated the SIM and spoke to technical support several times. However I could not seem to register on the cell network for more than five minutes before being disconnected. It seems that the Nexus One stores the network that you are registered to and doesn’t offer a clear option to change the default network. I ended up doing a factory reset and seeing as all my settings and data were backed up to Google’s servers, I was up and running again within five minutes with an awesome cell reception and stable 3G connection. Goodbye three! Despite being a loyal customer, you took advantage and insulted me, so I wont be missing you.
Another minor annoyance is answering calls. Sometimes when the phone rings the screen does not wake up, which means I have to press the top button and then swipe to answer, which sometimes does not register for what ever reason. I would like to make answering calls less fiddly. Obviously the main complaint is the battery life. If you run everything and play about a lot, which is natural when you get a new toy, the battery will last around a day, which when compared with the Nokia E71 is just appalling. My solution was to have the auto brightness adjustment on, I turned off my 3G APNs with APN Droid and can manually enable them when I want mobile internet and I usually turn off GPS and Bluetooth until they are needed. So far, Including taking/making calls, reading e-mails, checking Facebook sending and receiving SMS and listening to music to and from work the battery will go down to around 74% after a day which is far, far better. I decided to give the music player a test run and went into Birmingham on the bus which is 45 minutes each way. I spent around 3.5 hours listening to music and by the time I got home the battery was at critical ( < 15% ) which disappointed me slightly as it rules out the phone for use on long distance journeys as a music player.
After a week or so, I got curious about the Android SDK, so I decided to take some time out and have a quick peek at what was going on. Turns out that Android applications run on the Dalvic virtual machine and the code is all Java. So a quick install of the ADT plugin for my device emulators, a quick install of Eclipse and Subclipse (for Subversion) and a download of the Android SDK and I was nose deep in documentation.
It turns out that Developing Android Applications is very easy and uses a similar paradigm as MVC for web applications. So I spend last Sunday tinkering around and wrote my first proper application after Hello World! which was Droid Partridge. It is a very simple application which plays Alan Partridge’s classic moments and has a dialog box. I eventually released this on to the world via the Android Marketplace, so others can download and install and enjoy the pocket comedy for those socially appropriate moments where “Jurassic Park!” is needed to be said out loud. Over the next few weeks I will be updating this application to include more sounds with better compression and iron out any bugs.
Developing on Android was fun and quick, however the tool kit does have some drawbacks. The interface designer which creates the view layouts in XML is rather lacking and is not quite up to the standard that VE (Visual Editor) was for Eclipse all those years ago, nor is it up to scratch with the WPF / Silverlight visual designer. (which also defines it’s interfaces in XML) It is a shame really as that part makes the whole process much more difficult for newcomers who just want to define a very basic UI to play around with.
Another drawback is the mobile device emulator itself, on a Quad core machine with 4GB of ram (My development machine at work) it is still as painful as trying to run through a swimming pool of treacle, it is so terribly slow! Also if the program does throw an exception during runtime, I often get the ‘Source Not Found’ window open up in the debugging perspective and I can only hazard guesses where it has gone wrong from the not too helpful stack traces that seem to have no mention of any calls to my code.
Despite this, I am quite committed to keep on tinkering with Android. True, I did pay $25 USD for the Android Marketplace account, but it is also a very nice development experience, very much unlike Windows Mobile development. I have a few nifty ideas that I want to try, for which I have yet to see a solution for and also a couple of colleagues have thrown suggestions at me so at least I have something to keep me out of trouble and off the streets of Meriden!
A while back I did mention that I was developing a Windows Mobile Twitter application, that has been abandoned completely as I’ve jumped on to the Google bandwagon and riding off in to the sunset to get as far from Microsoft and it’s stagnation as possible. I just hope that for all our sakes, that Google stick to their “Don’t be evil” ideals.
P.S.
Just in-case you didn’t notice, like the new theme ?
Heart of England Way
Mar 13th
Well it has been a busy weekend so far, managed to get my land line installed finally. It involved running around like a madman after the bus home broke down, getting a taxi to the village, answering client phone calls whilst standing in a chippy. (which I must say, Meriden chip shop is awesome)
So now hopefully next week I will have a proper Internet connection rather than the temperamental (the connection speed depends on which part of the arm of the couch it is on…..) 3G connection through my mobile phone.
Anyway after a shipment from Argos with my new shiny freezer, chair and desk arrived (whilst in the shower this morning), assembling that and doing shopping for the next couple of weeks, I decided to go for a wander into the countryside to relieve my headache and rest my eyes for a while.
I knew that the Heart of England Way ran through Meriden before I moved here, but couldn’t find accurate maps on where it was, without having to fork out 12 pounds for a map book. (HA!) After wandering down Main Street I found the beginnings of the public footpaths that run up the little hill into fields a onwards into the surrounding countryside.
Now I had started walking at around 16:00 so I had a wonderful view down on to the Birmingham Plateau and I could even see where I used to live 16 miles away! To my left I could catch glimpses of Coventry city centre and sadly I did pass through a field where a farmer was spraying muck, NOT A NICE SMELL!
I only walked a very short way, 2 hours 20 minutes round trip, however the walk was enjoyable, the views were stunning and the route is very well signposted which calmed my paranoia that I was going to get horribly lost.
I ended up in the tiny village called Berkswell, which has a wonderful little church, Tudor style thatched houses and is all that you can expect for a quaint little village. Sadly I didn’t linger too long as I was swiftly running out of daylight and I wandered back the way I came to Meriden where I was followed by ducks.
There seems to be a pattern forming with me and ducks.
Overall, a nice chilled Saturday with no work and the discovery of a really nice and quiet route to walk along, might try going north tomorrow or next weekend and there is always the possibility of making a day out of it!
Anyway here are a few mediocre shots that I took on my E71, which to my horror I didn’t notice that the camera settings were on low till I got back
- Another attempt to get a sunset shot, bleached out :(
- Nice little pond, no ducks though
- It was a nice house!
- Nice little area to sit and think before going home
- Small yet beautiful little church
- The sun shining on the field was rather gorgeous here, just leaving Berkswell
- Right on the horizon, you can just make out the city centre
- Managed to get the E71 camera to produce a lens flare!
- Almost home!
- The ducks decide to follow me home. GAH!
Installing Trac on 64 Bit Ubuntu 8.04 (Hardy)
Mar 9th
This is a fairly basic guide which is mostly for my reference, but feel free to use it. I do not take responsibility for server failure, data loss or if your switch starts sending toast over the internet to your computer after following this guide. Follow this rough guide at your own risk.
NOTE: This guide is roughly based on a more complete guide here
Some assumptions are going to be made here.
- You have subversion installed already and your repos are in /var/svn
- You have set this up for access via apache. (Quick Guide coming soon)
- Your websites are in their own directory in /var/sites/
First install the required programs from the universe repository. If you are using ubuntu (Hardy) server, you will need to edit the /etc/apt/repos.d file.
sudo nano /etc/apt/sources.list
Enter the following lines to the end of the file
deb http://archive.ubuntu.com/ubuntu/ hardy universe deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe
Save the file and now do the following to refresh the package list.
sudo apt-get update sudo apt-get upgrade
This will ensure that you have the latest and greatest of your currently installed packages to avoid any unforeseen problems. Now we need to install trac, you may get away with the following and apt will get any other dependencies for you.
sudo apt-get install trac
Or I used the command similar to the guide I saw.
sudo apt-get install enscript libapache2-mod-python python-docutils trac db4.3-util
Now once this is complete, create the directory for your trac instance and change the owner to the web server user. Depending on which distribution this could be httpd, apache or ww-data. In Ubuntu it is www-data.
sudo mkdir /var/sites/trac.yourdomain.com sudo chown -R www-data:www-data /var/sites/trac.yourdomain.com
And now we use the trac-admin program to initialise the environment, just follow the steps and remember where your svn repos are kept.
trac-admin /var/sites/trac.yourdomain.com initenv
Now to create the apache site, we are using named virtual hosts. So create the file and then open it for editing.
sudo touch /etc/apache2/sites-available/trac sudo nano /etc/apache2/sites-available/trac
Now the following site configuration will vary from person to person, the referenced guide at the start of this tutorial will show you more advanced features like self signed certificates for ssl rather than authenticating in plain text like the configuration below.
NameVirtualHost trac.yourdomain.com
<VirtualHost trac.yourdomain.com:*>
ServerAdmin adm...@yourdomain.com
DocumentRoot /var/sites/trac.yourdomain.com
DirectoryIndex Index.html
ServerName trac.yourdomain.com
ServerSignature Off
ErrorLog /var/log/apache2/trac_error_log
TransferLog /var/log/apache2/trac_access_log
<Directory "/var/sites/trac.yourdomain.com">
Options +Indexes +MultiViews
Order allow,deny
Allow from all
</Directory>
<Location />
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonInterpreter main_interpreter
PythonOption TracEnv /var/sites/trac.yourdomain.com/
PythonOption TracUriRoot /
AuthType Basic
AuthName "Trac"
# Use the SVN password file.
AuthUserFile /etc/subversion/passwd
Require valid-user
</Location>
</VirtualHost>
The Auth User File for subversion is generated when setting up the repos, which will be included in another guide.
Save and close the file (Ctrl + O and then Ctrl + X). Now before we start the new site we need to compile a python module (clearsilver) for python 2.5 as this is broken in hardy 64 bit. You will need the compilation tools installed and the required dependencies, which is just a single command.
sudo apt-get install build-essential zlib1g-dev python-dev autoconf build-dep python-clearsilver
Now download the latest version and extract the compressed file into a directory.
wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz tar zxvf clearsilver-0.10.5.tar.gz
Now we need to edit the configure scripts for compiling the module to allow it to build for python 2.5 so using our favourite text editor nano do the following:
nano clearsilver-0.10.5/configure.in
Now press Ctrl + W and type ‘python_versions’ and press enter.
Change the line to be the following
python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
Save and close the file. Now we repeat the process with the configure file
nano clearsilver-0.10.5/configure
press Ctrl + W and type ‘python_versions’ and press enter.
Change the line to be the following
python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
and Save and close the file. You can now build and install the module by doing the following
./configure make sudo make install
Now we need to copy the module binary into the python directory to replace the broken one.
sudo cp -bi python/neo_cgi.so /usr/lib/python2.5/site-packages/neo_cgi.so
Enable the trac site in apache.
sudo a2ensite trac
Now you can start the site up by either restarting or reloading apache
sudo /etc/init.d/apache2 reload
OR
sudo /etc/init.d/apache2 restart
Now surf up trac.yourdomain.com enter the user name and password (if you have set this up) and away you go!
Anyway I hope this is of some help to someone.
Special thanks to fluffypixies for the guide on fixing the python problem which can be found here.
Meriden
Mar 7th
Well I have managed to move successfully and seamlessly and now instead of living in the city centre of Birmingham I am now living in the centre of Meriden which is apparently also the centre of England! (The centre of the centre! was also tempted to throw in a HTTP 301 reference, but I’ll spare you that)
Anyway, Meriden is a wonderful and quiet little village roughly 6 km from Birmingham International and around 3 miles from where I work, which has cut my commute down to 5 minutes by bus which is awesome.
I find that I am a lot happier here with friendly people from the village who say hello and don’t mind if you talk to them. Also not having to pass through Birmingham New Street station is a plus as the entire place is just pure depression and to be honest, it is not what you need first thing on a Monday morning, especially when that is combined with the arrogance and ignorance of inner city dwellers/commuters.
Anyway, I have a bigger flat that is actually a one bedroom flat and not a tiny little studio. It has a kitchen, bathroom and separate living and bedroom. Combined with the lack of drunkards walking past the window at night and central heating (oh my god electric storage heaters are utterly rubbish at keeping you warm) my sudden departure from Birmingham doesn’t seem like a bad idea at all, however I am lacking in the freezer, computer desk and land line department, but those will be sorted out in due course I suppose.
Looking forward to trying out the Heart of England way and attempting to walk down towards Henley-In-Arden and perhaps see some remnants of the Arden forrest.
Sadly the internet is in the form of net book and E71 which sometimes can be fairly stable and other times wont stay connected for more than a minute, which suffices for day to day Facebook browsing. Another development concerns my Nokia E71 and how woefully unstable it is becoming. It no longer can produce sound out from the speaker, so that means no ring tones, no alarms and certainly no text message alerts which is rather infuriating and also indicates that I will need a new phone in the very near future. Another thing is that it seems to be getting more and more unstable as time goes on. The web browser takes an age to load and running a few programs usually causes a kernel panic and the phone reboots without warning at random intervals, which is both worrying and vexing.
Geeking wise, I haven’t been up to much at all recently. I’ve set up Subversion and Trac to play with when I have the free time and to also get all my code up in to a central location as I keep loosing things that are scattered over several hard disks and machines. I am also going to get accustomed with Nagios again so that I have a playground to fiddle and break so that I can finally get that monitoring server set up at work (Which has been on my TODO list for around a year now). Started coding for a project handed to me by a friend over a year ago and another that started in November. Very slow progress as the last thing I want to do is code when I get in from work during the week.
Anyway all is good in the land of Meriden, we had a drugs bust in the flats across the way which was talk of the village, so it’s all happening here, very glad I moved.
Hiatus
Feb 7th
I know this isn’t the most exciting and widely seen blogs, but for some reason I feel the need to put my ideas out on to the clouds of the internet. No idea why I feel like I should as it is highly unlikely you the reader will empathise or care, due to the fact that you stumbled here from google looking for HTC or Illegal Operations attempted on a registry key marked for deletion. (HINT: If you are using NHibernate, use static proxies, saves a lot of pain rebooting the server trying to get on the fly proxies to compile. If not, well it’s a compiler problem, eliminate as much JIT compilation as possible.)
Anyway I digress. I will probably be taking extended leave from the internet due to the fact that the flat I currently rent is being repossessed from under me. I wont bore you people who bounce off the site with the circumstances, but suffice to say I am angry. Anyway, go click on the stumble on plugin, find a more interesting site to read. XKCD is always good.
Spotify on HTC HD 2
Jan 20th
Recently I’ve decided to reconsider the HTC HD 2 given that I got rather frustrated with the touch keyboard and the lack of applications that actually use the landscape mode. I’ve developed patience for the keyboard and am managing to start liking the phone.
The next big hurdle is Spotify. I have a Spotify premium account for two reasons. First, I hate ads and in particular I hate being bombarded with the same ads over and over and over .. etc and second I like to listen to music on the way to work so Spotify on my Nokia E71 is a win.
I was horrified to notice that Spotify have overlooked the Windows Mobile platform and are seemingly reluctant to develop for it. There is however, a workaround called mySpot. So last night I decided to give it a try.
Snow, Games, HTC HD2 and Explosions
Jan 5th
A Happy New Year to all!
Sadly my immune system decided to take two days off resulting in most of new year’s eve consisting of watching films in bed and getting up at midnight to watch the fireworks from the terrace. Which I might add were rather spectacular and I am left warm and fuzzy knowing that Birmingham City Council are spending my council tax well.
Anyway, this gave me time to play Assassins Creed 2, which to be honest I wasn’t expecting anything fantastic considering the first one was pretty, unique and fun to play. Sadly it was killed by the repetitive side missions and mundane tasks which did not fit in to the assassin theme. I was however impressed, the storyline in the game continues right where you left off in the first game, so at least there is a little consistency. The game is far more pretty than the first one, running through Italian streets gazing at the architecture and finding new and amusing ways to kill the guards on the roofs.











Disappearance and Coding
Aug 11th
Posted by Will in Coding
No comments
Well, erm.. hello there!
Been a bit of a recluse when it comes to the blog, haven’t had exactly a lot of time to sit down and write an entry with work eating all my time and any free time is spent in the company of real people.
Also my sincere apologies to all you Droid Partridge users, the same situation has befallen the development with regards to work, I’ll try and get that sorted as quick as I can, hopefully by the end of this month.
Anyway not much to report here, been working a lot with jQuery (try it, it’s the most awesome thing to happen since tables!) and ASP.NET MVC at work, perfecting a template and refactoring very old and nasty code which has become difficult to maintain. The amount of projects that are marked for re-write it growing by the week.
Anyway the main theme of this post is to complain and complain a lot at Samsung’s general direction. They deserve it.
Debugging with Eclipse
Now to debug with the Nexus One, it’s a dream. You plug in the device with USB debugging enabled, Windows isntalls the drivers after a few pokes in the right direction and you click debug on Eclipse, it deploys and runs. I couldn’t ask for a more seamless debugging experience there, beats Visual Studio 2008 for Windows Mobile as I have to select a device or emulator whereas the ADT plugin does this for me depending on what is plugged in to the system at the time.
I decided in a brief moment of rational thought to attempt to try debugging on other handsets than my own Nexus One, although the idea of Android and one operating system over many handsets gives you the feeling that you are writing portable code that will run anywhere. I decided not to try my luck and test … just in case.
So, I enable USB debugging on the Samsung, plug it in and sat with a smug smile waiting for Windows to install the device drivers and Eclipse to pick up that another Android device was available to debug on, expecting the same seamless experience. I had never been so wrong.
First the device drivers did not install. After prodding the ‘Add a new device wizard’ to install the ADB Composite Device driver, I found that the ADB daemon was not registering the handset. A restart of the daemon and Eclipse brought me no further forward. I hit Google and found a few solutions which involved changing the ADB executable and .dll files, but they were from a few years ago, so I didn’t bother attempting them. Another involved tinkering with the .ini file in the usb_driver folder in the android SDK. I tried this, however it did not work at all.
After a lot of searching on Google, I found the solution which was not on any Android or Samsung documentation that I could find for Éclair and the GT-I9000 respectively which is absolutely disgraceful, so I’ve decided to write the steps out for you.
Why this wasn’t on offical documentation or at least a well known affliated wiki I will never know.
Credits to this forum post who gave me the answer. http://forum.xda-developers.com/showthread.php?p=7238660#post7238660
Bluetooth Pairing
In a nutshell. I’m writing an Android application for work at present and using my trusty Nexus One to test and debug. (Glad I bought it as it is now the official developer phone. Hurrah!) Anyway, I decided to test this application on another Android device to ensure that I was writing code that at least worked on two separate handsets. So I picked up a Samsung Galaxy S (GT-I9000) and started hooking it up for debugging. Now I am transmitting data via bluetooth (as per my woes in the previous post) and so I started the pairing process for the bluetooth device, and it did not show up. Odd.
I checked on my own Nexus One and a colleague’s Nexus One and yes the device was visible and I was able to pair up the device with the phones, but not on the Samsung, very strange. So I forced the bluetooth device to initiate pairing with the Samsung and no problems there. The bluetooth device has no user interface, so it is a tad clumsy trying to pair it up like this. Then I modified the program to search for the device I needed by matching the advertised name and connecting, hoping that the phone would pick it up and initiate the pairing process. Tested this on the Nexus One, no problem worked first time, now we move over to the Samsung handset.
Now to cover what I had, basically it is a very simple BroadcastReceiver class which has the Intent filters for ACOUNT_FOUND and DESCOVERY_FINISHED which was fired with the Nexus One, but not on the Samsung. A lot of profanity ensued at this point (I had just gotten over the debugging stupidity above) and I trawled the LogCat section of Eclipse and I found this gem:
I must say that I blinked once or twice and read this again trying to make sure I had gotten the meaning correct. Basically, Samsung have taken the liberty when modifying a version of Android (Éclair 2.1-update1) to ignore any bluetooth device which advertises itself as class 0×00 and wont allow connections, fire off Intents on discovery or even list it on the sodding bluetooth settings page. I was (and still am) outraged. Why on earth have they made this decision for me and can I override this behaviour or am I going to have to re-write/place the management module for bluetooth on Android? It is not a nice thing to be considering!
So far I’ve posted on xda-developers and the Android Developers Google group asking for assistance, I am not hopeful, which is a shame as it’s a damn impossible brick wall to smash through. I’ll post an update if I can get around this complete insanity on Samsung’s part. Any suggestions are more than welcome.
So there goes the line of thought that Android would be a good platform to develop for because everything is provided for you at no cost and manufacturers would never need to do more than skin and add their own applications in the ROMs that they ship with their handsets. I do hope I find the solution to this, Android is a very nice platform to develop on and comes on some very sexy handsets and it would be a great shame to have manufacturers like Samsung taking an awesome platform and ruining it so that when developers come along, they’ve got to write more code to cope with the idiotic decisions they make with the operating system.
Anyway, I’ll get back to coding, ranted enough for one evening, I’ll keep you all posted on Droid Partridge updates as soon as I have completed them.