Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, February 1, 2013

Music Glove Explained

I realize (thanks to a twitter follower) that I never really explained how my music glove actually works.
(Introducing Proof of Concept Music Glove)

Here goes.

The glove connects to the arduino over I/O. (basically just use some I/O pins to read a pressed state).

I wrote some code (referenced by this post: ) to transmit over the arduino's RS232 (Serial) port. The RN-42 uses RS232 to communicate to the device, so as long as the baud rate, etc are the same, then sending data from the Arduino to the RN-42 is a breeze.

Next we need a way to read the data. Download the bluetooth chat application from google (located here: ), modify it where the line says

Next I added some code to read received data.

The receive message section should look something like this:


Changing Volume, songs, etc, are all located in the following function I stuffed in there.

Of course you need a preferences to deal with things but you don't have to, you can simply just say if you see A, then do the action listed for the one you want in the above code.
Put it all together and you have a device which will change the volume or songs (if you set it up via preferences). Remember that some of the options are not publicly declared intents so they work right now, but may change in the future. If you have further questions go ahead and leave a comment, or find me on twitter @onaclov2000.

Tuesday, November 27, 2012

Syncing Picasa

Anyone here have a Google Picasa account? How about 2? (I'm thinking families here) More?

Sure someone can share an album with you, but if you want to view it, you have to find the link, until google allows shared albums to be visible in your account (and indirectly visible via your Android phone). You'll have to just deal with it.

I got tired of dealing with it, I started working on a project, right now it does a one way "copy" from one account to another, I have plans to finalize the checks that compare the folders (albums) and determine what differences exist, and move photos back and forth to sync them.

My current implementation runs from a python script, and you have to have the Google API's loaded. This is great for those cases where you only need to sync once. However I want to sync say, once a day. Using this locally would require my computer to be running, what if my other family members wanted to sync albums with eachother? Now we have multiple instances.

Eventually I would like to set this up to run on Google's App Engine on a daily or more frequent rate, however oddly enough, their API's are not as clearly available via App engine.

On a positive note, I hadn't really done much programming in Python prior to this project, now I've begun, I don't mind it as bad as I originally had (don't get me started on the whole whitespace thing).

If you're interested in what I'm working on and would like to poke around, follow along, (or maybe help) you're welcome to check out the repository located on GitHub.

I'll keep you updated as I move along with this project.

https://github.com/onaclov2000/PicasaSync


Monday, July 9, 2012

IAMHERE 2.0

Well I finally released an update, and IAMHERE has been improved. I added categories of texts, as well as a share button.

There are a few categories and if you have any suggestions let me know and I may add them to my list of updates to include.

If you have any suggestions let me know and I'll definitely look into them.

Thanks and have fun.

https://play.google.com/store/apps/details?id=com.onaclovtech.iamhere

Wednesday, April 25, 2012

Introducing Proof of Concept Music Glove

Well the day I never thought would come has arrived. I have finished a proof of concept of my android music control using an external (in this case glove) device.

It was a long and slow journey, I've often times got so many projects in the pipeline that it's really exciting when I get to see one finish up.

This evening I finished up wiring my device, and asked @civissmith over to help with the video, so Thanks I really appreciate it, trying to do what I was showing with one hand would have been, painful to say the least.

Basic concept, Buttons attached to arduino send characters to android app, when music is running, pressing a button allows control of the music app.

Shot of Glove
Shot of Glove


Button inside glove


Without further words, I think the video will be proof enough.




If you'd like to follow me on twitter I can be found here: @onaclov2000

Monday, April 16, 2012

Causing the next song to play

With the android music player you can change songs using the following broadcast. It's not guaranteed to work with any other music players, or even with any updates they make, however it works for what I need right now (I have no interest in making a music player), If you have a music app and have an intent to change songs,etc, please let me know and I'd be happy to support if possible. I found this across the interwebs somewhere probably nearly a year ago now, I can't remember where I found it, or who wrote it, so if you are the one responsible I would love to give you credit (i'm sure it came from stackoverflow at one point, but after a lot of searching recently I can't seem to find anything about it).
Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "next"); sendBroadcast(i);
Good luck.

Modifying Bluetooth Chat

I started out trying to pull the android bluetooth chat application from the developer website....BAD IDEA. I spent quite a bit of time commenting this out, adding a toast here and a if then there. That one is built for a different sdk version than I'm using, so my recommendation would be to pull it from the examples folder in the sdk download.

Well I finally grabbed the bluetooth chat application from the sdk examples folder (when you download from google). After about 5 minutes I tried loading the default app on my phone and touchpad, it worked just fine. I then changed ONE LINE of code and my arduino can talk to my android devices with bluetooth. What line say you? This one:

In the BluetoothChatService.java
From
private static final UUID MY_UUID = UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");

To
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");


That's it that's all it took. Apparently that UUID from what I've been able to gather is for the bluetooth serial interface, so that's all I needed.

Here is video proof of the application in action.





http://youtu.be/Zof0IYUU71Q

Good luck and let me know if you have any questions.

Monday, March 12, 2012

New Apps

New Apps Released!
Well it was a busy couple of weeks, I have released 2 apps on the market in the last few weeks.  Pizza Area, and I Am Here.

Pizza Area
This calculates the square inches of a pizza for you (really works for any size circle with a diameter), Also if you have a price it'll calculate the price per square inch, as well as the estimated cost at that rate for the pizza size smaller and larger that the app contains. Give it a try and let me know if you have any suggestions, and as always a positive rating on the appstore would be appreciated.


I Am Here
This app will allow you to select a friend from your contacts (or type the number in) and when you hit the icon it'll send a message. This app is very similar to another one on the Apple Market, I was a little disappointed I hadn't released this sooner, my buddy civissmith had come up with the idea originally,  and I was just way to slow to implement. Well give it a try either way, I think mine has a little more spunk then the Apple Market version.

That's all for now, I have so many projects in the works at all time, I just have to finish a few so I can write about them.

Tuesday, January 10, 2012

Android Like SQL Statement, sqllite sql software

While using sqllite sql software for android, I was runing into problems. I was able to do exact matches, but for some reason I couldn't get LIKE matches to work. I was hunting around like crazy trying to figure out how to write a LIKE statement in Android. I had a working example of '=' and figured it would be pretty simple to use the LIKE command. After many variations I just couldn't figure it out. I almost posted to stackoverflow but decided to read the information on the "rawQuery" parameters of the database methods.

After doing a little reading it turns out that if you enter in a ? in your query it pulls the selection arguments and stuffs them in where that ? is. My first example didn't exactly make it clear that ? was replaced with the arguments, so now that I knew that it led me to my next train of thought.

As silly as this might sound my original query that pulled exact matches in used this:
cursor = db.query(DBHelper.TABLE, null, DBHelper.C_TEXT + " =?", whereArgs, null, null,null);

I finally tried this:
cursor = db.query(DBHelper.TABLE, null, DBHelper.C_TEXT + " LIKE ?", whereArgs, null, null,null);

Guess what? The whereArgs get stuffed in the ? position.

As much as I could have sworn I tried this, apparently I tried various iterations. Be sure if you're going to  use this, make sure you have "column" space "LIKE" space "?" and then your arguments as the next parameter. If you notice that the first example I was using had no space between the front, between the = and ? as well as behind, this is part of what tripped me up, LIKE is a word so you have to be sure to separate them using the right spaces.

If you're not sure what a column is take a look at W3 Schools SQL Like Tutorial. It doesn't explain the ? and how that works with respect to android. But after reading to this point you should be able to use the LIKE command in android.

I hope this helps others, so long and short of it, I can now query my db with a like operator, and it works.

Note* whereArgs contains only one element which contains % on either side in my case (%string%). Perhaps in the future I'll poke around at the options when I have more then one string in that field.

Saturday, July 16, 2011

Building an Echo Server using Bluetooth and Blueterm

I recently picked up the Bluetooth moduleRN-42 This was a cheap low cost way to integrate Bluetooth into an upcoming project. First up was getting the pieces soldered. Thanks to Walter over at Walter's Epic Blog he hooked me up with a great soldering job.
He soldered up the power, ground, tx and rx lines, as well as the required SPI lines in case I need to program the device.
I got the itch a little bit ago and started doing some research on building an Android App to communicate with this thing (with the eventual plan to hook it up to a microcontroller). I found BlueTerm this program connects to a Bluetooth Device and sends UART data across.
I started thinking to myself I wonder how I can echo the data back without having to build the UART up for my microcontroller. I asked the question over at electronics.stackexchange, and of course being the impatient type I just jumped in and hooked the rx to the tx lines.
As you can probably guess from the little jumper above, those are the RX and TX lines. It worked, I type something and bam it echoes it back. I'll be posting more as I build this project up so stay tuned.

Sunday, July 10, 2011

AsyncTasking

I was attempting to place my calculations from eecon into an AsyncTask.  I initially thought I would make a common task, calling it from both my find factor activity, and my find interest activity. I had to deal with the whole mess of figuring out which one was being called, and whatnot. Then I ran across the problem of getting the data back from the task. I initially tried using the getstatus function that async provides, as well as the get function, this returns the result. Seems great right? WRONG! get is blocking, this means that when I kick off the async task, it doesn't just kick off and run and when it's done let the UI know it's done, I FROZE the UI. This is bad.  Now if my calculation is time consuming then we have a chance at a force close. I wanted to try to pass the data back to the UI components so hopefully I wouldn't have to cause the main thread to wait. I wasn't sure how to do this, but after reading about the AsyncTask more, I realized that the onPostExecute was supposed to update the calling UI thread. Finally I realized (after a little reading) you can place the AsyncTask class in as a subclass, this allows it to have access to the parent's elements. 

No more blocking and no more force closes from this calculation.

Good luck and Good night.

Saturday, July 2, 2011

Admob in Android

This link is great for just throwing a quick ad in with admob into your app.

http://code.google.com/mobile/ads/docs/android/fundamentals.html

followed by the following:

http://code.google.com/mobile/ads/docs/android/banner_xml.html

Basically you add the "publish code" jar to your app, then insert a few lines into your manifest. Then you place the banner into your app where you want.

The one piece that tricked me is that if you simply try to add the sample xml unit to your project you need to make sure that in the main layout (the one that declares the "android" namespace), you need to add the following:

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

Friday, July 10, 2009

Live Android CD

I'm working on learning the java language so I can develop apps for the G1, so far I have only managed to run the hello world, from a tutorial (not much time for learning the java language yet), so far its an interesting project. I hope to build some posts around what I learn.

I came across the below link talking about some users of the Google Code Community porting a version of the Android OS to a Live CD that you can run to on your desktop.

It looks quite interesting and I'm going to give it a try, now it looks like there are 3 options for downloading,
1. Torrent
2. 2 Part ISO (Not sure how that works)
3. 3 Part Rar file.

(download page link: download)

I'm probably going to give the torrent one a whirl and I'll give it a review in the near future.

Check out the main site link here:
Live Android