I was playing around with the ADK and wondering how it would be possible to make the connection work while the app was in the background. The first way I tried was to not close the connection in onPause(). This worked, since the file input and output streams were able to continue … until they were garbage collected. When other Android apps run in the background, they use a Service. I tried this out with the ADK, and it works! Check out the video demonstration below.
The initialization and opening of the ADK is still done in the main activity. We use the Application class as a friendly singleton to transfer the streams, file descriptor, and usb accessory over to the Service.
When the Service is started, it creates an Updater thread, which runs every second.
Log.d(TAG, "updater not running");
updater =new Updater();
Log.d(TAG, "updater running");
In background, this can run for a very long time. I let it be for 12 hours before I stopped it.
However… there is a very bizarre bug. Sometimes when the app returns to foreground, it can’t reconnect to the ADK. The main problem is with the USB Manager trying to open the accessory for some reason. The app has permissions to the accessory, and it prints out the connected accessory correctly. Here is my trace of the bug:
Here was a fantastic interview by Ian Cole, thanks so much Ian!
The future of Learning Pet is that there will be time spent on apps4arduino to make some money in order to be able to purchase some laser cut parts, 3d parts, and boards.
Here are some stats of the contest that I collected from the webpage:
- 51.9% had a prototype
- 48.1% showed a demo in their video
- 51.9% had a website
- 3.7% released their hardware files under a license for the open hardware definition
- 22.2% had their hardware files available
- 14.8% had a bom
- 5.6% released their source code under an osi license
- 22.2% had their code available
- 40.7% had documentation
- 22.2% had additional videos
- 59.3% said what they would do with the prize if they won
- 18.5% demoed while at the ohs
Introducing Learning Pet, a mini RoboBrrd with a very large theme- education! Learning Pet enriches lessons by creating a physical interface to interact with the virtual world.
We demonstrate a number sorting game, where the student interacts with the robot to blast virtual UFO’s with the lowest value. Correct answers are celebrated with a wing flap, and each level-up with a dance. We use the Accessory Development Kit to interface with mobile devices while away from the computer.
On LearningPet’s webpage, it has all the detailed information about the hardware, software and design. There is also a handy checklist at the top, so that at a glance you can quickly see the important facts.