09-28 00:13:41.708: D/IOIOImpl(21259): Physical disconnect.
09-28 00:13:41.708: D/IOIOImpl(21259): Connection lost / aborted
09-28 00:13:41.708: D/IOIOImpl(21259): Waiting for IOIO connection
09-28 00:13:41.713: V/IOIOImpl(21259): Waiting for underlying connection
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ioio.examples.hello_service" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="16" />
<application android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<uses-library android:name="com.android.future.usb.accessory"
android:required="false" />
<service android:name="HelloIOIOService">
<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" />
</service>
<activity android:label="@string/app_name" android:name="MainActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:resource="@xml/accessory_filter" android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/>
</activity>
</application>
</manifest>
public class HelloIOIOService extends IOIOService {
@Override
protected IOIOLooper createIOIOLooper() {
return new BaseIOIOLooper() {
private DigitalOutput led_;
@Override
protected void setup() throws ConnectionLostException,
InterruptedException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN);
}
@Override
public void loop() throws ConnectionLostException,
InterruptedException {
led_.write(false);
Thread.sleep(500);
led_.write(true);
Thread.sleep(500);
}
};
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (intent != null && intent.getAction() != null
&& intent.getAction().equals("stop")) {
// User clicked the notification. Need to stop the service.
nm.cancel(0);
stopSelf();
} else {
// Service starting. Create a notification.
Notification notification = new Notification(
R.drawable.ic_launcher, "IOIO service running",
System.currentTimeMillis());
notification
.setLatestEventInfo(this, "IOIO Service", "Click to stop",
PendingIntent.getService(this, 0, new Intent(
"stop", null, this, this.getClass()), 0));
notification.flags |= Notification.FLAG_ONGOING_EVENT;
nm.notify(0, notification);
}
}
@Override
public IBinder onBind(Intent arg0) {
return null;
}
}
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startService(new Intent(this, HelloIOIOService.class));
finish();
}
}
...
notification.flags |= Notification.<span style
--
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 ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.
Yes. This has been fixed, but not yet released. You can check out the latest code from the master branch on GitHub for the time being.
--
You received this message because you are subscribed to a topic in the Google Groups "ioio-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ioio-users/YSEBH7lwe-A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.
App and library. No need to touch the firmware if you have a v5.x installed.
The fact that the accesory connection intent has to go through an activity to the service is, as far as I know, the only way to do this in Android. If you find a better way to do this let me know.