-1

I have a Nexus 6(Google Fi) I got an app that works on all other devices I tested but not on this one. Trying to create a directory or a file under this GetExternalStorageDirectory() is not working; I have tried mkdirs() as well. I cannot see the emulated/0 folder from my FileExplorer(on the phone) or from my PC(W10). And yes I do have the manifest permission for writing files. Using the following...

---Definition
public static String currentdirectory=Environment.getExternalStorageDirectory() + "/ADAK";
---Code snipplet
    sd = new File(G.currentdirectory);
    if (!sd.exists() && !sd.isDirectory()) {
        if (!sd.mkdir()) {
            G.WTL("Cannot create ADAK directory");
            G.WTS(this, "Cannot create ADAK directory");
            System.exit(0);
        }
    }
Marionette
  • 33
  • 1
  • 8
  • There is an answer to this already. i don't know how to reference another question but it is in 33162152 – ashcliffe Mar 20 '16 at 12:42
  • possible duplicate: http://stackoverflow.com/a/24781338/2087463 – tmthydvnprt Mar 20 '16 at 13:22
  • 4
    Possible duplicate of [how to create a folder in android External Storage Directory?](http://stackoverflow.com/questions/24781213/how-to-create-a-folder-in-android-external-storage-directory) – tmthydvnprt Mar 20 '16 at 13:23
  • this i don't think is a duplicate. I am trying myself in nexus 6p to create a public folder but the possible dublicate answer does not work !! – Wang'l Pakhrin Jun 15 '16 at 08:33
  • Wang'l, this is such a confusing topic. You do need to handle those permissions differently in API 23 which is the 6p, test your API level in the code and then request permissions, careful this is an asynch request; a real pain since it breaks your previous code. Google is looking into providing a synch request for this, dont konw if this will happen. But I dont know the specifics of your code. – Marionette Jun 16 '16 at 09:41

1 Answers1

1

Android 6.0 Marshmallow using API 23 have a new requirement, permissions must be requested each time the application starts. All of this is well documented by Google. http://developer.android.com/training/permissions/requesting.html

Marionette
  • 33
  • 1
  • 8