Hi Ytai, ioio users,
I recently bought at sparkfun my IOIO-Otg board to make some stuffs with
external sensors.
I spent several days to understand a little the android's world...waw...It
wasn't so easy.
Whatever, now I used the template simple app in my root class activity
extended by IOIOActivity.
....and IOIO Board is always connecting when I plug the usb... Great ...
BUT... I'm facing to an always disconnection issue when usb is plugged...
After the usb is plugged, I absolutely need to restart my app.
And then it's ok.
*Samsung Galaxy III GT19300*
Android Version 4.3
*IOIOLIB*: IOIO0504
*Appfirm* : IOIO0500
*Bootloader*: IOIO0400
*Hardware*: SPRK0020
To explain my small issue
----------------------------------
1 - App is compiled and installed from Android Studio.
2 - Then my phone is manually restarted. (or not whatever)
3 - RePowering the IOIO board with 6V regulated. (or not whatever)
4 - Plug usb between the two devices
5 - My app is auto activating by default by the open accessory and launch
my main activity containing a small led blinking loop.
6 - Then it works... but it stays connected only 3 seconds...
7 - So I press the phone's BackButton to return to android desktop (The
board is still plugged with phone and not removed)
8 - I restart my app...and then it stays correctly connected without auto
disconnecting.
*So I needed to restart the app twice to work fine...and then only the loop
is no more broken...*
If someone has facing the same behavior ?
Is there a trick I miss somewhere during initialization or in manifest file
?
Maybe it's the thread that check the connection, when board connected,
thread is sleeping...or destroyed by android.
I also noticed that into the *AndroidManifest.xml*
I absolutely necessary to add ...
<intent-filter>
<action
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<intent-filter>
<action
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
... these intent-filter inside the first activity that contains :
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If not, when I plug usb, android will notify that it doesn't know any
application that will use ioio board - IOIO Standard Application
*But in that case, I doesn't need to restart my app to get the loop
functioning. It works fine the first time.*
*But I need to fight with android notification to cancel it several
times...*
Then, I think I will continue to use the open accessory protocol to auto
launch my app when board is plugged to the phone...
But then I need to find a way to restart twice the app... Kill the first
instance and relaunch a new one.
Do you know a way to do that ?
Thanks for help.
Lo.
--
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.