Disable SDcard permission from AndroidAppSettigns.cfg

This commit is contained in:
Sergii Pylypenko
2013-12-23 22:47:05 +02:00
parent 8d328c39d5
commit 2319578a79
4 changed files with 51 additions and 30 deletions

View File

@@ -72,6 +72,7 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
import android.content.pm.PackageManager;
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
@@ -391,6 +392,11 @@ class Settings
Log.i("SDL", "libSDL: SD card or external storage is not mounted (state " + Environment.getExternalStorageState() + "), switching to the internal storage.");
Globals.DownloadToSdcard = false;
}
if( p.getPackageManager().checkPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, p.getPackageName()) != PackageManager.PERMISSION_GRANTED )
{
Log.i("SDL", "libSDL: We don't have permission to write to SD card, switching to the internal storage.");
Globals.DownloadToSdcard = false;
}
Globals.DataDir = Globals.DownloadToSdcard ?
SdcardAppPath.getPath(p) :
p.getFilesDir().getAbsolutePath();