Thanks for the quick reply, Ytai! I have arranged the entries in .addBootstraps such that the code was pretty but it only worked for socket connections. If I understand you correctly, you're saying that the .addBootstraps should only include one connection type, because only the first one is used. Is that correct or could other methods go before Socket?
Would changing the order to Accessory, Bluetooth, Socket then allow usb, bluetooth and lastly ADB connections to the IOIO from my app? --Danny On Monday, July 27, 2015 at 12:29:55 AM UTC-5, Ytai wrote: > > IOIOFactory.create() instantiates a IOIO using the first connection type > in the registry (socket in this case). > When connecting over USB to Android 4.x or greater you need to use > Accessory mode. You can use the version of create that gets a connection > instead. You'd be pretty much reinventing the wheel though. Not sure why > you'd want to go through this pain... > On Jul 25, 2015 19:19, "Danny Epperson" <[email protected] <javascript:>> > wrote: > >> Hi Ytai and friends, >> >> I'm having some trouble writing a new IOIO app for Android. My trouble is >> getting the IOIO to connect directly to the phone. I've used this IOIO >> before and verified that it works when wired directly with other apps just >> fine on this phone. When I use the IOIOBridge it works fine with my app and >> the app can connect to the IOIO. When I'm not using IOIO bridge (trying OTG >> adapter plugged into Samsung GS3), the android app never sees the IOIO >> connection. >> >> >> The pertinent part of my code is below. Note that before I added the >> .addBootstraps the app would just crash with an exception. Maybe something >> is still incomplete there? >> >> >> public class Mechanical extends Thread { >> >> protected IOIO myioio; >> private PwmOutput servo, motor; >> >> public Mechanical(Context context) >> { >> mContext = context; >> } >> >> final String tag = "Mechanical"; >> >> // thread setup >> @Override >> public final void run() >> { >> super.run(); >> while (true) >> { >> Log.d(tag, "thread startup"); >> try >> { >> // required for IOIOFactory to work >> IOIOConnectionRegistry.addBootstraps(new String[]{ >> "ioio.lib.impl.SocketIOIOConnectionBootstrap", >> "ioio.lib.android.device.DeviceConnectionBootstrap", >> >> "ioio.lib.android.accessory.AccessoryConnectionBootstrap", >> >> "ioio.lib.android.bluetooth.BluetoothIOIOConnectionBootstrap" >> }); >> >> synchronized (this) >> { >> myioio = IOIOFactory.create(); >> } >> myioio.waitForConnect(); >> >> >> I'm aware that this isn't the preferred method of running the IOIO (Thread >> instead of Activity). Do you see anything obviously wrong that would make it >> only work on the IOIOBridge? Must I re-write my app to communicate with the >> IOIO from the Activity instead of the Thread? (I'd prefer to keep that code >> elsewhere) >> >> >> Thanks! >> >> --Danny >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ioio-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/ioio-users. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
