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].
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.