Sample android app for phidgets USB host mode

Supporting 4.1 and up
ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Sample android app for phidgets USB host mode

Postby ohp » Sun Apr 01, 2012 9:46 am

I understand that USB host mode is now supported on android 3.1 and above. Has anyone produced a simple android app that demonstrates that functionality? I'm working on how to create an app myself, but I have an opportunity to demonstrate it on Thursday, and I'm not going to get my own app working in time.

If not, I'll get another opportunity to do a demo in a months time, so if I get something working, I'll let you know, and post an update.

User avatar
burley
Human-Cyborg Relations
Posts: 441
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: Sample android app for phidgets USB host mode

Postby burley » Mon Apr 02, 2012 7:16 am

We have one on the programming resources page under Android. There should be two, one of which uses webservice and the other uses USB.

http://www.phidgets.com/programming_resources.php
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com

ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby ohp » Tue Apr 03, 2012 2:04 pm

burley wrote:We have one on the programming resources page under Android. There should be two, one of which uses webservice and the other uses USB.

http://www.phidgets.com/programming_resources.php


Yeah, I found it, and I'd hoped to reply to my message before someone else did :)

Got it all up and running in eclipse. My own project can't even see the phidgets library (class not found exception), and the phidgets project has a verify error. I didn't think it was going to be easy....

ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby ohp » Tue Apr 03, 2012 2:21 pm

The problem that's tripping things for both my app and the phidgets demo app is this one:

04-03 20:07:35.145: I/dalvikvm(1102): Could not find method com.phidgets.usb.Manager.Initialize, referenced from method com.phidgets.InterfaceKitUSB.InterfaceKitUSBExampleActivity.onCreate

I'm guessing it's because I'm an eclipse newbie. I've probably added the jars wrong or something. Strangely it's happy to compile and build the apk though.

ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby ohp » Tue Apr 03, 2012 2:53 pm

I've tried it in netbeans too, no luck. I can make an android app, but as soon as I do anything with phidgets, including importing the example project as per the instructions, it just can't find the Manager class.

Any help would be gratefully received!

ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby ohp » Wed Apr 04, 2012 11:43 am

OK, problem solved. Libraries need to go in a libs directory to be deployed (a change in a recent development kit update)

ohp
Phidgetsian
Posts: 7
Joined: Sun Apr 01, 2012 9:39 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby ohp » Wed Apr 04, 2012 2:38 pm

Well, I can get it onto my tablet. I have a servo phidget, so I rewrote the interface phidget to do something with the servo phidget, but alas, nothing.

Am going to see if I can remotely debug it, to find out why not. I wasn't asked for permission to use usb on either my app or the phidgets demo app, so that worries me.

macoas
Fresh meat
Posts: 1
Joined: Tue May 15, 2012 5:46 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby macoas » Tue May 15, 2012 5:53 am

hi!.I tried running the example in my galaxy nexus but it does not work. I have a spatial Phidget and the web service works fine. I think that's a problem with the USB host that don´t detected the Phidget. Any ideas?

thanks

broehl
Fresh meat
Posts: 4
Joined: Thu Jun 14, 2012 4:42 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby broehl » Thu Jun 14, 2012 4:52 am

I'm trying to get the USB interface example running on my Galaxy Tab.

The device comes with a cable with a (presumably proprietary) connector at one end and a USB Type A plug at the other.

I'm using a USB cable kit to connect to the Phidget board. The hit has an adapter than has a female Type A connector at each end, so I plug the male USB connector from the tablet cable into that adapter and use a cable that has a male Type A at one end and a male Mini-A at the other, which I plug into the Phidget board.

I think a lot of those details don't matter, but I'm including as much info as possible to help track down the problem I'm having.

I build the app in Eclipse, having copied the jar files to the lib directory (thanks for the tip, by the way). Builds and runs fine.

However... in the app it says "Status: Detached", and all the other fields (Name, Serial Number, Version, Label) are all "Unk.".

I have no idea what the problem might be, hoping you'll have some suggestions.

Thanks in advance for any help.

broehl
Fresh meat
Posts: 4
Joined: Thu Jun 14, 2012 4:42 am
Contact:

Re: Sample android app for phidgets USB host mode

Postby broehl » Thu Jun 14, 2012 5:07 am

Just a follow-up... I managed to find an A to mini-A adapter, so I've eliminated all the cables and other adapters. The USB cable from my tablet plugs into the adapter, into the Phidget board.

So I don't think it's a cable problem. I also checked logcat, and there are no error messages from the app.


Return to “Android”

Who is online

Users browsing this forum: No registered users and 0 guests