What is the fundamental difference between:

getApplicationInfo().dataDir 

and

 File sdDir = android.os.Environment.getExternalStorageDirectory(); 

I understand that the first function will return the location of the directory where the application is located. The second will return the path if there is an sd card in the mobile phone.

But what are their fundamental differences apart from the physical location of the files.

For example, the second function which folder will return? That which is allocated for my application on an SD disk?

If the phone does not have a removable SD disk, but only the internal memory is like that of the Nexus, what then?

If my application downloads files from the Internet, then saving to SD do I need to create a separate path for all this, or again, is there a dedicated place for my application?

    1 answer 1

    getExternalStorageDirectory() will return the path to the SD card, not to the folder intended for storing files on the SD card for your application.
    getApplicationInfo().dataDir will return the path to the directory of your application in /data/data/

    You can always check for yourself which path will return any method just by calling it. I recommend checking out the next time before asking a question.