» »Unlabelled » New permissions requirements for Android TV

Posted by Anirudh Dewani, Developer Advocate



Android 6.0 introduces a new runtime permission model that gives users more granular control over granting permissions requested from their apps and leads to faster app installs. Users can also revoke these permissions from Settings at any point of time. If an app running on the M Preview supports the new permissions model, the user does not have to grant any permissions when they install or upgrade the app. Developers should check for permissions that require runtime grant from users, and request them if the app doesn’t already have them.



To list all permissions that require runtime grant from users on Android 6.0 -




adb shell pm list permissions -g -d


RECORD_AUDIO



Apps should generally request as few permissions as possible. Voice search is an integral part of Android TV content discovery experience. When using the internal SpeechRecognizer to enable Voice Search, apps must declare RECORD_AUDIO permission in the manifest. RECORD_AUDIO requires explicit user grant during runtime in Android 6.0. When using the Android TV Leanback support library, apps can eliminate the need for requesting RECORD_AUDIO during runtime by using SpeechRecognitionCallback instead of SpeechRecognizer.



SearchActivity.java



Commit from Android TV Leanback Sample repository.





mFragment = (SearchFragment) getFragmentManager()
.findFragmentById(R.id.search_fragment);

if (!USE_INTERNAL_SPEECH_RECOGNIZER) {

mSpeechRecognitionCallback = new SpeechRecognitionCallback() {

@Override
public void recognizeSpeech() {
if (DEBUG) Log.v(TAG, "recognizeSpeech");

// ACTION_RECOGNIZE_SPEECH
startActivityForResult(mFragment.getRecognizerIntent(), REQUEST_SPEECH);
}
};
mFragment.setSpeechRecognitionCallback(mSpeechRecognitionCallback);
}




When SpeechRecognitionCallback is set, Android Leanback support library will let the your activity process the voice search action instead of using the internal SpeechRecognizer. The app can then use RecognizerIntent to support speech recognition.



If you have an Android TV app targeting API Level 23, please update the app to use SpeechRecognitionCallback and remove RECORD_AUDIO permission from your manifest.

About Unknown

Web Sayfamızda, Bilgisayar, İntenret, Güvenlik Sistemleri, Cep Telefonları, Tablet Bilgisayarlar, Navigation Sistemleri, Modem Kurulumları ve Smart TV ayarları ile ilgili tamamı görsel anlatımla hazırlanmış makaleler bulabilirsiniz. Keyifli Zaman Geçirmenizi Dileriz.
«
Next
Sonraki Kayıt
»
Previous
Önceki Kayıt

Hiç yorum yok :

Yorum Gönder