The system process can not access the SD card, period.  And any questions
about code in there should be on android-porting, thanks.

On Wed, Dec 2, 2009 at 5:14 PM, Tan <[email protected]> wrote:

> Hi all
>
> I have the same problem, the code writes to emulator even if there is
> no permission and does not write to SD card even if there is
> permission WRITE_EXTERNAL_STORAGE.  If it is not possible to write in
> system process then how can i modify my code? Here is the snippet
> that
> writes stuff
> File directory = new File(Environment.getExternalStorageDirectory
> ().getPath() , "fingerprint_UC_basement");
>                   if (!directory.exists()) {
>                           directory.mkdir();
>                   }
>                   File file = new File(directory.getPath() ,
> filename);
>                   if (!file.exists() && directory.exists()){
>                           try {
>                               file.createNewFile();
>                               FileOutputStream fo = new
> FileOutputStream(filename);
>                               String a = "Size: " + APs.size();
>                               fo.write(a.getBytes());
>                               for(int i=0; i< APs.size(); i++){
>                                String b = APs.get(i).getBSSID() + "
> "
> + APs.get(i).getdBm() + " " + APs.get(i).getCount();
>                                fo.write(b.getBytes());
>                               }
>                               fo.close();
>                           } catch (IOException e) {
>                                   Log.d(TAG,"File creation failed
> for
> " + file);
>                           }
>                   }
>
>
>
> Someone also pointed out that its not possible to write to SD card
> through System process, we have to run a separate service for that.
> Can anyone verify that? Thanks
>
> Tan
>
>
> On Nov 12, 11:43 am, lei <[email protected]> wrote:
> > Thanks, Mark. It's solved. The permission of WRITE_EXTERNAL_STORAGE is
> > required in Android SDK1.6,
> > also I find a link describe it:
> http://developer.android.com/sdk/android-1.6.html
> >
> > On Nov 12, 3:44 pm, Mark Murphy <[email protected]> wrote:
> >
> >
> >
> > > lei wrote:
> > > > I find thefilethat path to Environment.getExternalStorageDirectory()
> > > > is not writable, how could I change it?
> >
> > > Make sure your app has the WRITE_EXTERNAL_STORAGE permission.
> >
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://twitter.com/commonsguy
> >
> > > Android Training in Germany, 18-22 January 2010:
> http://bignerdranch.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to