[android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread powder

I have this already in my Manifest:

...






On Jul 8, 1:34 pm, Mark Murphy  wrote:
> The WRITE_EXTERNAL_STORAGE permission was added in API Level 4. By
> saying you are targeting that API level, you will need to add that
> permission to your manifest.
>
>
>
>
>
> On Thu, Jul 8, 2010 at 7:28 AM, powder  wrote:
> > I have a piece of code that copies a file to the sdcard, it always
> > worked. But changing the following
> > line in the Manifest from:
>
> > 
>
> > to
>
> > 
>
> > Gives me a error (have not changed anything else). Anyone have an
> > explanation?
>
> > 07-08 13:13:38.121: ERROR/myApp(266): /mnt/sdcard/myapp/customer.db
> > (Permission denied)
> > 07-08 13:13:38.121: ERROR/myApp(266): java.io.FileNotFoundException: /
> > mnt/sdcard/myappt/customer.db (Permission denied)
> > 07-08 13:13:38.121: ERROR/myApp(266):     at
> > org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
> > 07-08 13:13:38.121: ERROR/myApp(266):     at
> > org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:
> > 152)
>
> > Regards Jonas.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

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


[android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread powder

It works und 2.2 in the emulator, so the new path is tested and works,
but changing to the following it stops working:



instead of



Is it a bug or what am I not doing correctly?

On Jul 8, 2:31 pm, Adrian Vintu  wrote:
> thank you Mark. good to know :)
>
>
>
> On Thu, Jul 8, 2010 at 2:27 PM, Mark Murphy  wrote:
> > On Thu, Jul 8, 2010 at 8:16 AM, Adrian Vintu 
> > wrote:
> > > where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?
>
> > > could it be that your path is wrong? should it not be /sdcard/...?
>
> > The path varies by device and Android release. /mnt/sdcard is typical
> > for Android 2.2, at least in the emulator.
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com|http://github.com/commonsguy
> >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android App Developer Books:http://commonsware.com/books
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread powder

I finally found the problem, my post above and my code was wrong,
moving the permissions outside  tag worked:






Many thanks for all the suggestions...

On Jul 8, 6:37 pm, powder  wrote:
> It works und 2.2 in the emulator, so the new path is tested and works,
> but changing to the following it stops working:
>
> 
>
> instead of
>
> 
>
> Is it a bug or what am I not doing correctly?
>
> On Jul 8, 2:31 pm, Adrian Vintu  wrote:
>
>
>
> > thank you Mark. good to know :)
>
> > On Thu, Jul 8, 2010 at 2:27 PM, Mark Murphy  wrote:
> > > On Thu, Jul 8, 2010 at 8:16 AM, Adrian Vintu 
> > > wrote:
> > > > where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?
>
> > > > could it be that your path is wrong? should it not be /sdcard/...?
>
> > > The path varies by device and Android release. /mnt/sdcard is typical
> > > for Android 2.2, at least in the emulator.
>
> > > --
> > > Mark Murphy (a Commons Guy)
> > >http://commonsware.com|http://github.com/commonsguy
> > >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > Android App Developer Books:http://commonsware.com/books
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com > >  cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread Adrian Vintu
where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?

could it be that your path is wrong? should it not be /sdcard/...?


On Thu, Jul 8, 2010 at 1:39 PM, powder  wrote:

>
> I have this already in my Manifest:
>
> ...
> android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
> android:name="android.permission.READ_EXTERNAL_STORAGE"/>
>
> 
> 
>
> On Jul 8, 1:34 pm, Mark Murphy  wrote:
> > The WRITE_EXTERNAL_STORAGE permission was added in API Level 4. By
> > saying you are targeting that API level, you will need to add that
> > permission to your manifest.
> >
> >
> >
> >
> >
> > On Thu, Jul 8, 2010 at 7:28 AM, powder 
> wrote:
> > > I have a piece of code that copies a file to the sdcard, it always
> > > worked. But changing the following
> > > line in the Manifest from:
> >
> > > 
> >
> > > to
> >
> > > 
> >
> > > Gives me a error (have not changed anything else). Anyone have an
> > > explanation?
> >
> > > 07-08 13:13:38.121: ERROR/myApp(266): /mnt/sdcard/myapp/customer.db
> > > (Permission denied)
> > > 07-08 13:13:38.121: ERROR/myApp(266): java.io.FileNotFoundException: /
> > > mnt/sdcard/myappt/customer.db (Permission denied)
> > > 07-08 13:13:38.121: ERROR/myApp(266): at
> > > org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
> > > 07-08 13:13:38.121: ERROR/myApp(266): at
> > > org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:
> > > 152)
> >
> > > Regards Jonas.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
> >
> > Android App Developer Books:http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread Mark Murphy
On Thu, Jul 8, 2010 at 8:16 AM, Adrian Vintu  wrote:
> where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?
>
> could it be that your path is wrong? should it not be /sdcard/...?

The path varies by device and Android release. /mnt/sdcard is typical
for Android 2.2, at least in the emulator.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

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


Re: [android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread Adrian Vintu
thank you Mark. good to know :)


On Thu, Jul 8, 2010 at 2:27 PM, Mark Murphy  wrote:

> On Thu, Jul 8, 2010 at 8:16 AM, Adrian Vintu 
> wrote:
> > where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?
> >
> > could it be that your path is wrong? should it not be /sdcard/...?
>
> The path varies by device and Android release. /mnt/sdcard is typical
> for Android 2.2, at least in the emulator.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Re: Adding android:targetSdkVersion="4" gives me a sdcard (Permission denied)

2010-07-08 Thread Xavier Ducrohet
Always use 
http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()
to find the proper location of the sd-card. Never hard-code it in your
code.

Xav

On Thu, Jul 8, 2010 at 5:31 AM, Adrian Vintu  wrote:
> thank you Mark. good to know :)
>
>
> On Thu, Jul 8, 2010 at 2:27 PM, Mark Murphy  wrote:
>>
>> On Thu, Jul 8, 2010 at 8:16 AM, Adrian Vintu 
>> wrote:
>> > where does the "/mnt" come from in /mnt/sdcard/myapp/customer.db ?
>> >
>> > could it be that your path is wrong? should it not be /sdcard/...?
>>
>> The path varies by device and Android release. /mnt/sdcard is typical
>> for Android 2.2, at least in the emulator.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Android App Developer Books: http://commonsware.com/books
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.

Please do not send me questions directly. Thanks!

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