In attempting to solve this issue, I believe I have successfully extended the official Android Bluetooth Chat example to work with a server connecting to multiple clients.
I've uploaded my modifications to github here:
https://github.com/polyclef/BluetoothChatMulti
One device acts as the server by selecting "Menu>Make discoverable". Each client then connects by selecting "Menu>Connect a device". I was successfully able to connect my Motorola Droid and HTC Eris as clients to my Samsung Galaxy Tab 10.1". Each message sent from a client displays only on the server. A message sent from the server displays on all clients.
This was a tedious process getting it to work at all. Connectivity with the HTC devices is sporadic, though. I've read elsewhere that bluetooth on HTC is buggy, so I'm chalking it up to that.
Hopefully someone else will find this example useful. If you have any questions, suggestions, or other feedback, please let me know.
Wednesday, June 8, 2011
Friday, May 27, 2011
What We've Got Here is...Failure to Communicate: Bluetooth, Android, and iPhone
I'm disheartened and exhausted now, after trying to break ground on a new game that would involve peer-to-peer networking among a number of Android and iPhone devices.
What I want is to have an app that would install on tablets (e.g. Xoom, iPad) and act as a server. Players would connect to the server with phone-sized devices and exchange information with the server.
My first inclination was to use bluetooth. Well, just getting two test devices connected to a tablet is something I haven't been able to accomplish. The BluetoothChat example in the Android SDK enables connection and communication between two devices, with a single app that can function as either the server or client. I've tried to modify this app into two distinct apps: a dedicated server and client, and that works fine. But attempting to connect a second device has proven undoable so far.
I made a couple of modifications to the example code so that the AcceptThread continues to listen, even after the first connection is made (the example stops listening after the one connection is made, because it only needs to establish connections between two devices). I created an ArrayList to handle the multiple connections. Each time a new connection is attempted from a remote device, a new ConnectedThread is created and added to the list.
The first client connects just fine.
When the second client attempts to connect, the connection fails. The log output is:
D/BluetoothEventLoop( 140): Device property changed: property: Connected value: true
I/BluetoothService( 140): ACL connected, mAclLinkCount = 2
D/BluetoothEventLoop( 140): Device property changed: property: Connected value: false
I/BluetoothService( 140): ACL disconnected, mAclLinkCount = 1
So it looks like the second connection attempt is successful, but then it is immediately disconnected. This looks like it's happening at a low level, outside anything the code is handling. This happens with a number of different types of test devices, so I don't think it's due to a particular firmware or hardware issue.
At the Lafayette Mobile Developer's meetup last night, we talked about bluetooth communication between Android and iPhone devices. I hadn't even looked into the iPhone side, but I should have known that they basically don't have a bluetooth API for iOS. Or rather, they don't have one that allows Apple devices to talk to non-Apple devices. Bluetooth on iOS can be done through GameKit. This thread on Stack Overflow suggests that it would be possible to spoof the GameKit functionality on Android to allow an Android device to talk to an iOS device, but I can see no indication that anyone has done such a thing.
I noticed in the same thread that the Bump API is mentioned, and I always assumed that it used bluetooth or some other kind of local connectivity. Nope...it uses a device's data connection, sends information to the cloud and syncs up devices based on their GPS position, which is kind of cool, but it also means that devices without a network connection (e.g. wifi only devices) can't use it. This is a deal breaker, because a lot of tablets are going to be wifi only.
So what about wifi? Well, on that front it sounds like Android does not support ad-hoc peer-to-peer networks, at least according to this post.
I find this ridiculous and depressing that these devices are all equipped with multiple ways to communicate locally, but in both cases (Android and iOS), the SDK functionality doesn't allow a way for them to talk to one another enough to write a simple app that pass something like a string between devices. NFC technology might enable local communication effectively, but it doesn't sound like NFC capabilities are coming to iPhone anytime soon, and they may be locked down if/when they do.
At this point I'm not even sure that a wifi-only tablet and multiple phone client app is going to work. It will likely work fine within a given platform, but not cross-platform, and that is extremely limiting.
Bah.
What I want is to have an app that would install on tablets (e.g. Xoom, iPad) and act as a server. Players would connect to the server with phone-sized devices and exchange information with the server.
My first inclination was to use bluetooth. Well, just getting two test devices connected to a tablet is something I haven't been able to accomplish. The BluetoothChat example in the Android SDK enables connection and communication between two devices, with a single app that can function as either the server or client. I've tried to modify this app into two distinct apps: a dedicated server and client, and that works fine. But attempting to connect a second device has proven undoable so far.
I made a couple of modifications to the example code so that the AcceptThread continues to listen, even after the first connection is made (the example stops listening after the one connection is made, because it only needs to establish connections between two devices). I created an ArrayList to handle the multiple connections. Each time a new connection is attempted from a remote device, a new ConnectedThread is created and added to the list.
The first client connects just fine.
When the second client attempts to connect, the connection fails. The log output is:
D/BluetoothEventLoop( 140): Device property changed:
I/BluetoothService( 140): ACL connected, mAclLinkCount = 2
D/BluetoothEventLoop( 140): Device property changed:
I/BluetoothService( 140): ACL disconnected, mAclLinkCount = 1
So it looks like the second connection attempt is successful, but then it is immediately disconnected. This looks like it's happening at a low level, outside anything the code is handling. This happens with a number of different types of test devices, so I don't think it's due to a particular firmware or hardware issue.
At the Lafayette Mobile Developer's meetup last night, we talked about bluetooth communication between Android and iPhone devices. I hadn't even looked into the iPhone side, but I should have known that they basically don't have a bluetooth API for iOS. Or rather, they don't have one that allows Apple devices to talk to non-Apple devices. Bluetooth on iOS can be done through GameKit. This thread on Stack Overflow suggests that it would be possible to spoof the GameKit functionality on Android to allow an Android device to talk to an iOS device, but I can see no indication that anyone has done such a thing.
I noticed in the same thread that the Bump API is mentioned, and I always assumed that it used bluetooth or some other kind of local connectivity. Nope...it uses a device's data connection, sends information to the cloud and syncs up devices based on their GPS position, which is kind of cool, but it also means that devices without a network connection (e.g. wifi only devices) can't use it. This is a deal breaker, because a lot of tablets are going to be wifi only.
So what about wifi? Well, on that front it sounds like Android does not support ad-hoc peer-to-peer networks, at least according to this post.
I find this ridiculous and depressing that these devices are all equipped with multiple ways to communicate locally, but in both cases (Android and iOS), the SDK functionality doesn't allow a way for them to talk to one another enough to write a simple app that pass something like a string between devices. NFC technology might enable local communication effectively, but it doesn't sound like NFC capabilities are coming to iPhone anytime soon, and they may be locked down if/when they do.
At this point I'm not even sure that a wifi-only tablet and multiple phone client app is going to work. It will likely work fine within a given platform, but not cross-platform, and that is extremely limiting.
Bah.
Thursday, May 12, 2011
Google I/O 2011
Google I/O 2011 wrapped up yesterday. Overall it was another great experience. I attended for the first time last year.
First off, I/O had a much bigger Android footprint than last year. That might have something to do with the fact that the platform has exploded in growth. But this year they devoted an entire floor to Android. Some pics...
Here's me showing my love for the green guy:

Here you can see the giant Android figures all over the place:


They even tore up the carpet on the third floor and put down custom Android carpeting. There were autonomous Android-bots roaming around bumping into people and chirping as well.
And the first day keynote focused on Android, rather than teasing us until the second day, like last year.
Goodie-wise, they gave us all a new Samsung Galaxy limited edition 10.1" tab, which is pretty sweet, though I hope they don't release the software in this condition when it goes live. I've found some page rendering in the browser (ironically, the acceptance to Google Music Beta didn't render properly on my tab). I couldn't find the books app, either natively installed or on the market. And I couldn't find a native video player. When I uploaded an mp4 to try it out, I could not find it via the file explorer or any other way. So I basically couldn't figure out how to play a video that I put on the device. Unlike other Android devices, when you attach it to a PC it either needs to be in USB debugging mode, and if that is toggled off, you can then mount for file transfer. But every other Android device allows you to do both when attaching to a PC. This is pretty weird. We're supposed to get an OS update in "a few weeks", so hopefully that will clear up a lot of these issues.
We also got invitations to Google Music Beta. I'll discuss that when I play around with it more. We got a promise that we'd get information on how to claim free ChromeBooks, laptops running the new ChromeOS. I'm somewhat skeptical about this paradigm, but I'm still looking forward to trying it out. And finally, we all got mobile wi-fi hotspots with 3 free months from Verizon. Thanks to Google and the manufacturers!
Some people also received the new Sony-Ericsson Xperia play phones if they were lucky enough to attend a particular session on Day 2. I think this was a pretty bad idea. First of all, second day Android sessions had very severe capacity issues, so many devs, including myself, weren't able to attend most of the Android afternoon sessions, including the one with the giveaway. In fact, I think it's possible that rumors of a giveaway may have created the congestion. So this was bad for the two main reasons that it possibly kept some developers from attending sessions they wanted to attend, and it probably engendered some bad feelings from devs who selectively received free phones.
I actually heard another rumor that HTC wanted to give away phones to everyone, but Google thought that level of hardware giveaway would be too extreme. Ah well. So I didn't get a phone, which I need to upgrade. And unfortunately the Nexus S is not available on Verizon. So I'll probably end up getting a Thunderbolt, or possibly switching carriers.
Anyway, I had a good time, and got to talk to a lot of nice folks from Google, as well as other devs. I didn't meet up with nearly as many devs as last year. I think they could do a better job of facilitating networking between devs with common interests, and I told them as much in my feedback note.
So I'll most likely be there next year as well.
First off, I/O had a much bigger Android footprint than last year. That might have something to do with the fact that the platform has exploded in growth. But this year they devoted an entire floor to Android. Some pics...
Here's me showing my love for the green guy:

Here you can see the giant Android figures all over the place:


They even tore up the carpet on the third floor and put down custom Android carpeting. There were autonomous Android-bots roaming around bumping into people and chirping as well.
And the first day keynote focused on Android, rather than teasing us until the second day, like last year.
Goodie-wise, they gave us all a new Samsung Galaxy limited edition 10.1" tab, which is pretty sweet, though I hope they don't release the software in this condition when it goes live. I've found some page rendering in the browser (ironically, the acceptance to Google Music Beta didn't render properly on my tab). I couldn't find the books app, either natively installed or on the market. And I couldn't find a native video player. When I uploaded an mp4 to try it out, I could not find it via the file explorer or any other way. So I basically couldn't figure out how to play a video that I put on the device. Unlike other Android devices, when you attach it to a PC it either needs to be in USB debugging mode, and if that is toggled off, you can then mount for file transfer. But every other Android device allows you to do both when attaching to a PC. This is pretty weird. We're supposed to get an OS update in "a few weeks", so hopefully that will clear up a lot of these issues.
We also got invitations to Google Music Beta. I'll discuss that when I play around with it more. We got a promise that we'd get information on how to claim free ChromeBooks, laptops running the new ChromeOS. I'm somewhat skeptical about this paradigm, but I'm still looking forward to trying it out. And finally, we all got mobile wi-fi hotspots with 3 free months from Verizon. Thanks to Google and the manufacturers!
Some people also received the new Sony-Ericsson Xperia play phones if they were lucky enough to attend a particular session on Day 2. I think this was a pretty bad idea. First of all, second day Android sessions had very severe capacity issues, so many devs, including myself, weren't able to attend most of the Android afternoon sessions, including the one with the giveaway. In fact, I think it's possible that rumors of a giveaway may have created the congestion. So this was bad for the two main reasons that it possibly kept some developers from attending sessions they wanted to attend, and it probably engendered some bad feelings from devs who selectively received free phones.
I actually heard another rumor that HTC wanted to give away phones to everyone, but Google thought that level of hardware giveaway would be too extreme. Ah well. So I didn't get a phone, which I need to upgrade. And unfortunately the Nexus S is not available on Verizon. So I'll probably end up getting a Thunderbolt, or possibly switching carriers.
Anyway, I had a good time, and got to talk to a lot of nice folks from Google, as well as other devs. I didn't meet up with nearly as many devs as last year. I think they could do a better job of facilitating networking between devs with common interests, and I told them as much in my feedback note.
So I'll most likely be there next year as well.
Friday, March 25, 2011
Polyclef Apps Now Available on Amazon App Store
So Amazon launched its Android app store this week. Leading up to its release, I was skeptical that it would really do any better than any other 3rd-party app store. The official Google Android Market comes preinstalled on most devices. A 3rd-party app store requires the user to go out and find it, set their phone to accept non-market installs, and install it manually. Amazon has the further requirement of entering in payment information, even if you only want to download free apps.
Who would jump through all these hoops for a market with way fewer apps than the Android Market, most of them shared between the two?
Well apparently a lot of people. The reason? I guess I should have trusted that the people at Amazon would have a trick or two up their sleeves, and the magic ingredient was Angry Birds. Specifically, a new app called Angry Birds Rio that is exclusive to the Amazon App Store, and free for a limited time. Angry Birds is so incredibly popular that exclusive content was a genius way to drive users specifically to the Amazon Appstore. Once the user has jumped through the initial hoops, the market is just as reliable and easy to use as the official one.
I have over 30 apps on Android. I took a cautious approach to the Amazon Appstore by only submitting two apps, WordWise Pro and Golf Solitaire. So far they're doing well enough to get me to submit additional apps. There may just be an initial rush, but I don't think so. I'm thinking now that Amazon has probably done things right and will continue doing so.
For now, here are the links to WordWise Pro and Golf Solitaire on the Amazon Appstore. More to come soon.
Who would jump through all these hoops for a market with way fewer apps than the Android Market, most of them shared between the two?
Well apparently a lot of people. The reason? I guess I should have trusted that the people at Amazon would have a trick or two up their sleeves, and the magic ingredient was Angry Birds. Specifically, a new app called Angry Birds Rio that is exclusive to the Amazon App Store, and free for a limited time. Angry Birds is so incredibly popular that exclusive content was a genius way to drive users specifically to the Amazon Appstore. Once the user has jumped through the initial hoops, the market is just as reliable and easy to use as the official one.
I have over 30 apps on Android. I took a cautious approach to the Amazon Appstore by only submitting two apps, WordWise Pro and Golf Solitaire. So far they're doing well enough to get me to submit additional apps. There may just be an initial rush, but I don't think so. I'm thinking now that Amazon has probably done things right and will continue doing so.
For now, here are the links to WordWise Pro and Golf Solitaire on the Amazon Appstore. More to come soon.
Saturday, February 12, 2011
Match and Hatch for Android Preview
I'm happy to announce that we're close to releasing a new match-3 game for Android called "Match and Hatch".
If you're not familiar with the match-3 genre of casual games, like Bejeweled, basically the goal is to move elements on the screen to make matches of 3 or more of the same element in a row, either horizontally or vertically.
Ahead of Easter, I thought an egg theme would be kind of cool, though it's not explicitly an Easter game. There are a couple of twists on typical match-3 play. For one, every time you make a match, the eggs hatch open, revealing either points, pets, or food.
If you find a pet (some are much rarer than others), you can then view them on the pet screen:
Once you hatch a pet, you'll need to take care of it at least a couple of times a day, by feeding it and showing it a little attention (you can pet the critters by rubbing their head or their belly). This increases their happiness and levels them up. If you neglect your pets long enough, they'll level down and eventually run away.
I thought this blend of match-3 and virtual pets would be a cool hybrid. We'll see. I'm going to release the paid version first, probably for $1.99, followed closely by a free ad-based version. Then I'm going to look into using Google's new in-app purchase system to allow users to directly purchase food and pets. Some players may want to spend hours and hours hatching eggs, but others may enjoy the pet aspect more.
And I'm also likely going to commission an iPhone version in the near future.
Stay tuned...I'll let you know when it hits the market!
PetPass for iPhone is Now Live!
It took a while, but our new social networking app PetPass is now live on the iTunes app market:
http://itunes.apple.com/ru/app/petpass/id385460118?mt=8
If you have an iPhone or know someone who does, check it out! It's free.
http://itunes.apple.com/ru/app/petpass/id385460118?mt=8
If you have an iPhone or know someone who does, check it out! It's free.
Thursday, November 18, 2010
PetPass
This summer I commissioned an app based on an idea I had: What if you could create a virtual mail carrier, put a message and/or photo in its mailbag, and pass it (physically) to a friend, then they could add a message and/or photo and pass it to someone else, and so on? You could also track your pet's journeys around the world and see all the places and people it has interacted with. That was the idea behind PetPass...kind of a chain mail Twitter with cute animals, leveraging the Bump API.
It's been a rocky road getting this thing produced, but we finally got it submitted to Apple yesterday. It's still a little rough around the edges (especially when it comes to handling poor network connectivity). Here's how it works:
The app is free. You get 100 credits with the free download. It costs 10 credits to create a new pet. You choose a pet type (monkey, panda, robot, etc.) and give it a unique name. Then you add a message and (optionally) a photo to its mailbag. You click Pass Pet. A friend of yours who also has the app on their device clicks Receive Pet. You shake your phones near each other and the pet passes from your phone to theirs. You earn 1 credit for each pet you pass, though you can't earn more credits by passing the same pet multiple times. You can also purchase 10 credits for $0.99.
Will people like and use this app? I really don't know. I thought the idea sounded cool at the time. I'd been wanting to produce a social networking app, and one that used both in-app purchases and the Bump API. But who knows?
It is implemented reasonably well, and it is free. Though I've found that ironically users tend to be even harsher on free apps than they are on paid ones. You do get a lot more downloads with a free app, so the chances of it catching on are increased by the price tag. It should take another week or so for the app to be approved (or rejected). If the app does reasonably well on the iPhone, I will develop an Android version. The Bump API allows for transactions between iPhone and Android devices. But we'll have to see how it does first.
Subscribe to:
Posts (Atom)