Hi my service gets started, but the thing is its not getting listed in
the hyper terminal log that is line LOGI("Service started");
If not the hyperterminal where will it be logged????? and pls tel me
how to create socket and connect to
a external server through internet and communicate with it...


On May 18, 9:53 am, Gopi <[email protected]> wrote:
> Hi Apologies,
> The mistake i did was those silly spaces in my 'c' header include. I
> got it working.Can any one tel me how to create socket and connect to
> a external server through internet and communicate with it...
>
> On May 17, 12:09 pm, Gopi <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I m trying a create a new init service to start when the OS boots. I
> > have created a simple example that writes the time elapsed since it
> > started to the log. It wakes up every three seconds. The code for
> > exampleservice.c looks like:
>
> > #define LOG_TAG "Example Service"
> > #include < utils/log.h >
> > #include < unistd.h >
> > int main(int argc, char **argv)
> > {
> >     LOGI("Service started");
> >     int elapsed = 0;
> >     while(1)
> >     {
> >          sleep(3);
> >          elapsed += 3;
> >          LOGI("Service elapsed time is %d", elapsed);
> >     }
>
> > }
>
> > and added the following to the init.rc
>
> > service exampleservice /system/bin/exampleservice
> > user exampleservice
> > group exampleservice
> > oneshot
>
> > the Android.mk file looks like the following
>
> > ifneq ($(TARGET_SIMULATOR),true)
>
> > LOCAL_PATH:= $(call my-dir)
>
> > include $(CLEAR_VARS)
> > LOCAL_SRC_FILES:= exampleservice.c
> > LOCAL_MODULE := exampleservice
> > LOCAL_C_INCLUDES := \
> >     $(call include-path-for, system-core)/cutils
> > include $(BUILD_EXECUTABLE)
>
> > endif  # TARGET_SIMULATOR != true
>
> > i have added a folder test_gopi in the directory \frameworks\base\cmds
> > which contains the exampleservice.c & Android.mk file
>
> > when i build i get the following error:
>
> > frameworks/base/cmds/test_gopi/exampleservice.c:2:26: error:  cutils/
> > log.h : No such file or directory
> > frameworks/base/cmds/test_gopi/exampleservice.c:3:22: error:
> > unistd.h : No such file or directory
> > frameworks/base/cmds/test_gopi/exampleservice.c: In function 'main':
> > frameworks/base/cmds/test_gopi/exampleservice.c:6: warning: implicit
> > declaration of function 'LOGI'
> > frameworks/base/cmds/test_gopi/exampleservice.c:10: warning: implicit
> > declaration of function 'sleep'
> > make: *** [out/target/product/devkit8000/obj/EXECUTABLES/
> > exampleservice_intermediates/exampleservice.o] Error 1
>
> > Please help me in solving this issue and guide me how to connect to a
> > socket from the service when the OS boots....- Hide quoted text -
>
> - Show quoted text -

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to