I need to READ a .txt from the external storage on my android device, it works but i have to grant the permission accessing to my phone´s settings. What i want is the app I made asks me if I want to grant the permission after o when its beeing instaled. Doing some research I found this code for WRITE in the example "DataCapture" in the ketai library. It works, I get the dialog box asking me for the permission. I´ve been triying to modify this for the READ_EXTERNAL_STORAGE but i failed. I have checked the box in the sketch permissions, still does not work.
setup {
requestPermission("android.permission.WRITE_EXTERNAL_STORAGE", "handleRequest");
}
void handleRequest(boolean granted) {
if (granted) {
db = new KetaiSQLite(this);
//lets make our table if it is the first time we're running
if ( db.connect() )
{
// for initial app launch there are no tables so we make one
if (!db.tableExists("data"))
db.execute(CREATE_DB_SQL);
}
}
}
There are a lot of examples for android about this but for processing-android mode only found this one. Hope someone can help me. Thanks