The proper way to emit log messages in Android is using the Log class
methods.


On Wed, Sep 10, 2014 at 12:03 PM, Majid ff <[email protected]> wrote:

>
> I just use the example mentioned by Ytai with some modification, and now
> IOIO remain connected and the app work even when the android screen goes
> off. I am using PIR connected to the IOIO and with the following code the
> IOIO led turn on if somebody move infront of the PIR. I debugg the code in
> Eclipse using wifi, for some reason Eclipse doesn't show all log, for
> example when I add "System.out.println(" PIR off .....")" to the code, It
> is not appear in the logCat! any way the code is work fine:) thanks for
> every one for help.
>
> package ioio.examples.hello_service;
>
> import android.app.NotificationManager;
> import android.content.Intent;
> import android.os.IBinder;
> import ioio.lib.api.AnalogInput;
> import ioio.lib.api.DigitalOutput;
> import ioio.lib.api.IOIO;
> import ioio.lib.api.exception.ConnectionLostException;
> import ioio.lib.util.BaseIOIOLooper;
> import ioio.lib.util.IOIOLooper;
> import ioio.lib.util.android.IOIOService;
>
> public class HelloIOIOService extends IOIOService {
>     @Override
>     protected IOIOLooper createIOIOLooper() {
>         return new BaseIOIOLooper() {
>             private DigitalOutput led_;
>             private AnalogInput deigital_input;
>             int i = 0;
>             private float InputStatus;
>
>             @Override
>             protected void setup() throws ConnectionLostException,
>                     InterruptedException {
>                 led_ = ioio_.openDigitalOutput(IOIO.LED_PIN);
>                 deigital_input = ioio_.openAnalogInput(45);
>             }
>
>             @Override
>             public void loop() throws ConnectionLostException,
>                     InterruptedException {
>                 InputStatus = deigital_input.getVoltage();
>
>                 if(InputStatus >= 3.0){
>                     if (i == 0){
>                     i = 1;
>                     led_.write(false);
>                     };
>
>                 }else{
>                     led_.write(true);
>                     i = 0;
>                 }
>                 Thread.sleep(100);
>             }
>
>         };
>     }
>
>     @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")) {
>             nm.cancel(0);
>             stopSelf();
>         } else {
>
>         }
>     }
>
>     @Override
>     public IBinder onBind(Intent arg0) {
>         return null;
>     }
>
> }
>
>
>
>
> On Wednesday, September 10, 2014 4:37:05 PM UTC+2, Bill Carter wrote:
>>
>>
>> I've had the same issues with apps I am writing. Each view, or screen, in
>> Android is a separate activity, and actually a separate process. If you
>> implement the IOIO connection inside the activity it will disconnect when
>> the activity goes to sleep or you transition to a different view. I've been
>> working with the IOIOService example, but services are a much more
>> complicated architecture and no easy task for a beginner to grasp. You have
>> to bind to the service, implement callbacks and send and receive Intents.
>> Its an order of magnitude more complicated than just running IOIO from a
>> single activity.
>>
>  --
> 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.
>

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