Saving Logcat to a text file in Android Device

Use an Application class at the beginning of your app. That allows a proper file and log handling. Code below creates a log file at the following location: /ExternalStorage/MyPersonalAppFolder/logs/logcat_XXX.txt XXX is the current time in milliseconds. Every time you run your app, a new logcat_XXX.txt file will be created. public class MyPersonalApp extends Application { … Read more

Android Open External Storage directory(sdcard) for storing file

I had been having the exact same problem! To get the internal SD card you can use String extStore = System.getenv(“EXTERNAL_STORAGE”); File f_exts = new File(extStore); To get the external SD card you can use String secStore = System.getenv(“SECONDARY_STORAGE”); File f_secs = new File(secStore); On running the code extStore = “/storage/emulated/legacy” secStore = “/storage/extSdCarcd” works … Read more

Do I have to declare both WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE?

It’s best to be explicit and declare both permissions, but declaring only android.permission.WRITE_EXTERNAL_STORAGE will automatically add android.permission.READ_EXTERNAL_STORAGE to your APK at build time. You can use the command aapt dump badging on an APK to see that Android considers usage of the write permission to imply that you also want read permission. Here’s some output … Read more

is there a maximum size to android internal storage allocated for an app?

If you use Environment.getExternalStorageDirectory() (or Context.getExternalFilesDir() for API level 8 and up) as the place for your json file, then I believe the size will be limited by the available space in the external storage (usually an SD card). For most devices, I believe there are no fixed limits built into Android for external file … Read more

Android 6.0 Marshmallow. Cannot write to SD Card

I faced the same problem. There are two types of permissions in Android: Dangerous (access to contacts, write to external storage…) Normal Normal permissions are automatically approved by Android while dangerous permissions need to be approved by Android users. Here is the strategy to get dangerous permissions in Android 6.0 Check if you have the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)