Posts tagged Profanity
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.
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.

The problem with Google
May 3rd
Posted by Will in General Comments
No comments
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.