The SD card is not mounted early in boot, that doesn't happen until the
mount service has started and verified the SD card's filesystem.  Generally
it won't be available for use until around the time the UI comes up.

On Thu, May 26, 2011 at 4:42 AM, Gopi <[email protected]> wrote:

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



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to