Hi,
   I m trying to write log to sdcard. I have created a native service
that starts during boot and i want it to write a log file to
sdcard..my c file looks like this logservice.c

#define LOG_TAG "Log Service"
#include <cutils/log.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
FILE *file;
file = fopen("/data/all.log","a+");
fprintf(file,"%s","My Service started - My check");
fclose(file);
return 0;
}

the service gets listed in the android services....
but the file is not created in the sdcard...
more over please tel me when to insert the sdcard, i m inserting the
sdcard before android boot and the card info gets listed in the
settings. please help in this issue.
I also tried a application that writes the file to the sdcard even
this also din worked.
I have changed the r/w permission to all for sdcard also using chmod
777.
the app creates a file in sdcard

File root = Environment.getExternalStorageDirectory();
if (root.canWrite()){
File myfile = new File(root, "myfile.txt");
FileWriter myfilewriter = new FileWriter(myfile);
BufferedWriter out = new BufferedWriter(myfilewriter);
out.write("Hello world");
out.close();

It would be great if i get some guidelines or sugessitions...
Thank you.

On May 25, 10:39 am, Gopi <[email protected]> wrote:
> Hi,
>     Can any one help me getting the system info or device info and
> then logging it to the sdcard through an init service that is a native
> service like mysysinfo.c and the service gets started as the os boots
> like another init services.....

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

Reply via email to