Hey Majid,

In AndroidManifest, move the code between "<service>" and "</service>" tags 
to between "<activity>" and "</activity>" tags. Or, instead of moving it, 
just copy it and paste it between these two last tags.

Sábado, 27 de Setembro de 2014 23:48:43 UTC+1, Majid ff escreveu:
>
> I am using the service example "HelloIOIOService", whenever it is start it 
> is work fine but when I stop it and try to start it again it doesn't work 
> unless plug out and plugin the usb cable between the IOIO and the device 
> again. 
> Even this way doesn't succeed all time, some time work some time not! and 
> it shows "No installed apps work with this USB accessory........"
>
> My IOIO has the following info: Hardware ID: SPRK0020 Bootloader ID: 
> IOIO0400 Firmware ID: IOIO0500
>
>
> The connection is look like not reliable, what is the wrong? is it the app 
> itself or hardware issue?
> In Eclipse LogCat, it is continue shows the following even the IOIO is 
> already connected physically:
> 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
>
>
>
>
> I have already followed the instruction in the link 
> github.com/ytai/ioio/wiki/ADK and my Manifest file as below (I also 
> create the file accessory_filter.xml in the directory /res/xml:
>
>
> AndroidManifest.xml
> <?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>
>
>
>
> HelloIOIOService.java
> 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.<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 [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.

Reply via email to