Re: [android-developers] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2013-01-02 Thread Mind
I ended up using the following:

if 
(android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))
cacheDir=new 
File(android.os.Environment.getExternalStorageDirectory().getAbsolutePath(), 
context.getString(R.string.app_name_for_SharedPrefs));
else
cacheDir=context.getCacheDir();

Then check bools from: cacheDir.exists() and cacheDir.canWrite() and decide 
if you need to use the existing dir, call cacheDir.mkdirs() or rather use 
context.getCacheDir()



On Monday, November 19, 2012 12:28:54 PM UTC-5, Nikolay Elenkov wrote:

 On Tue, Nov 20, 2012 at 2:08 AM, David Schreiber 
 flashma...@gmail.com javascript: wrote: 
  Hello again, 
  
  Probably you meant /sdcard/Android/obb/packagename, but this path is 
 no 
  more correct for a Nexus 7 with Android 4.2 (FYI I have the same problem 
 at 
  the moment). 

 Yes, I meant the full path, as you needed. It is kind of black magic: the 
 OS 
 translates direct references to the right path, so that apps that use 
 hard-coded 
 paths don't break right away. Also convenient when using the shell. 


-- 
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] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2012-11-19 Thread Didier Poulain
On a Nexus 7, before 4.2, getExternalStorageDirectory() returns 
/storage/sdcard0/. On 4.2 it returns /storage/emulated/0

1 - I'm working on expansion files, and to test it, the documentation 
recommends to manually put my obb file on the device. 
But /storage/emulated/ is read-only and I can not create a '0' folder 
(which does not exists so far), thus I can not upload the file. Also 
only /storage/sdcard0/ is shared.

2 - Will obb files be properly downloaded 
into /storage/emulated/0/Android/obb folder by Google Play on Nexus 7 4.2?

-- 
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] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2012-11-19 Thread Nikolay Elenkov
On Thu, Nov 15, 2012 at 3:39 AM, Didier Poulain haddoc...@gmail.com wrote:
 On a Nexus 7, before 4.2, getExternalStorageDirectory() returns
 /storage/sdcard0/. On 4.2 it returns /storage/emulated/0

 1 - I'm working on expansion files, and to test it, the documentation
 recommends to manually put my obb file on the device. But /storage/emulated/
 is read-only and I can not create a '0' folder (which does not exists so
 far), thus I can not upload the file. Also only /storage/sdcard0/ is shared.

Use adb push foobar.obb /sdcard/ and the files will end up in the proper place.


 2 - Will obb files be properly downloaded into
 /storage/emulated/0/Android/obb folder by Google Play on Nexus 7 4.2?


Probably.

-- 
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] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2012-11-19 Thread David Schreiber
Hello Nikolay,

is this some bad magic? Or how should the OS relate this expansion file 
with the app? Your recommended location doesn't have any package name in 
path?

Greetings, David

Am Montag, 19. November 2012 17:58:51 UTC+1 schrieb Nikolay Elenkov:

 On Thu, Nov 15, 2012 at 3:39 AM, Didier Poulain 
 hadd...@gmail.comjavascript: 
 wrote: 
  On a Nexus 7, before 4.2, getExternalStorageDirectory() returns 
  /storage/sdcard0/. On 4.2 it returns /storage/emulated/0 
  
  1 - I'm working on expansion files, and to test it, the documentation 
  recommends to manually put my obb file on the device. But 
 /storage/emulated/ 
  is read-only and I can not create a '0' folder (which does not exists so 
  far), thus I can not upload the file. Also only /storage/sdcard0/ is 
 shared. 

 Use adb push foobar.obb /sdcard/ and the files will end up in the proper 
 place. 

  
  2 - Will obb files be properly downloaded into 
  /storage/emulated/0/Android/obb folder by Google Play on Nexus 7 4.2? 
  

 Probably. 


-- 
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] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2012-11-19 Thread David Schreiber
Hello again,

Probably you meant /sdcard/Android/obb/packagename, but this path is no 
more correct for a Nexus 7 with Android 4.2 (FYI I have the same problem at 
the moment).

Greetings

Am Montag, 19. November 2012 18:06:18 UTC+1 schrieb David Schreiber:

 Hello Nikolay,

 is this some bad magic? Or how should the OS relate this expansion file 
 with the app? Your recommended location doesn't have any package name in 
 path?

 Greetings, David

 Am Montag, 19. November 2012 17:58:51 UTC+1 schrieb Nikolay Elenkov:

 On Thu, Nov 15, 2012 at 3:39 AM, Didier Poulain hadd...@gmail.com 
 wrote: 
  On a Nexus 7, before 4.2, getExternalStorageDirectory() returns 
  /storage/sdcard0/. On 4.2 it returns /storage/emulated/0 
  
  1 - I'm working on expansion files, and to test it, the documentation 
  recommends to manually put my obb file on the device. But 
 /storage/emulated/ 
  is read-only and I can not create a '0' folder (which does not exists 
 so 
  far), thus I can not upload the file. Also only /storage/sdcard0/ is 
 shared. 

 Use adb push foobar.obb /sdcard/ and the files will end up in the proper 
 place. 

  
  2 - Will obb files be properly downloaded into 
  /storage/emulated/0/Android/obb folder by Google Play on Nexus 7 4.2? 
  

 Probably. 



-- 
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] getExternalStorageDirectory() behaves differently on Jelly Bean 4.2

2012-11-19 Thread Nikolay Elenkov
On Tue, Nov 20, 2012 at 2:08 AM, David Schreiber
flashmasterd...@gmail.com wrote:
 Hello again,

 Probably you meant /sdcard/Android/obb/packagename, but this path is no
 more correct for a Nexus 7 with Android 4.2 (FYI I have the same problem at
 the moment).

Yes, I meant the full path, as you needed. It is kind of black magic: the OS
translates direct references to the right path, so that apps that use
hard-coded
paths don't break right away. Also convenient when using the shell.

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