Since Android 6.0, we need to request permissions during app runtime.
In my app, i\'m using local storage, camera, geolocation and audio recording permissions.
You need the ti.permissions module and a recompiled version of TiSDK :
/Users/[YOUR USER]/Library/Application Support/Titanium/mobilesdk/osx/
android
subdir and replace titanium.jar
with this jar : https://github.com/AppWerft/Tierstimmenarchiv/blob/master/modules/android/titanium.jartiapp.xml
replace <sdk-version>5.2.0.GA</sdk-version>
with your new named SDK (5.2.0.WhatYouWant) don't forget to insert <uses-permission android:name="android.permission.RECORD_AUDIO"/>
inside the tiapp.xml
under the <android .... >
nodeand after that, you can request storage permission with this snippet:
if (!require('ti.permissions').hasPermission('android.permission.RECORD_AUDIO'))
require('ti.permissions').requestPermissions(['android.permission.RECORD_AUDIO'], function(e) {
if (e.success != 0)
Ti.API.debug("Permissions OK");
else
Ti.API.warn("Permissions denied");
});