In most Android devices, the RecognitionService will be supplied by Google's native 'Now/Assistant' application.
Up until Android Oreo, I was able to query the languages supported by the Google Recognizer with the following simple code:
final Intent vrIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
// vrIntent.setPackage("com.google.android.googlequicksearchbox");
getContext().sendOrderedBroadcast(vrIntent, null, new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
// final Bundle bundle = intent.getExtras();
final Bundle bundle = getResultExtras(true);
if (bundle != null) {
if (bundle.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
Log.i("TAG", "onReceive: EXTRA_SUPPORTED_LANGUAGES present");
final ArrayList<String> vrStringLocales = bundle.getStringArrayList(
RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
Log.i("TAG", "onReceive: EXTRA_SUPPORTED_LANGUAGES size: " + vrStringLocales.size());
} else {
Log.w("TAG", "onReceive: missing EXTRA_SUPPORTED_LANGUAGES");
}
} else {
Log.w("TAG", "onReceive: Bundle null");
}
}, null, 1234, null, null);
However, since 8.0+ the extra RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES
is no longer contained in the response.
Before I attempt to file this as a bug, I wanted to firstly see if others could replicate - but also check if there has been an Ordered Broadcast behavioural change in API 26 I've somehow overlooked, which could be the cause of this.
Thanks in advance.
getVoiceDetailsIntent()
? – BudgieRecognizerIntent.ACTION_GET_LANGUAGE_DETAILS
– FeezeBroadcast
is completed successfully by checkinggetResultCode() == Activity.RESULT_OK
or ifgetResultData()
contains any value at the beginning ofreceive()
function? – EgoLog.i("TAG", "onReceive: EXTRA_SUPPORTED_LANGUAGES present");
.compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { applicationId "it.versionestabile.stackover001" minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }
Do you say instead not reaching that code? – Northwestcom.google.android.googlequicksearchbox, 7.2.29.21.x86
– NorthwestPackageManager packageManager = getPackageManager(); for (PackageInfo packageInfo: packageManager.getInstalledPackages(0)) { if (packageInfo.packageName.contains("com.google.android.googlequicksearchbox")) Log.d("AAA", packageInfo.packageName + ", " + packageInfo.versionName); }
– NorthwestName: Nexus_5X_API_26_No_Proxy CPU/ABI: Google Play Intel Atom (x86) Path: C:\Users\***\.android\avd\Nexus_5X_API_26_No_Proxy.avd Target: google_apis_playstore [Google Play] (API level 26) Skin: nexus_5x SD Card: 100M hw.dPad: no runtime.network.speed: full hw.accelerometer: yes hw.device.name: Nexus 5X vm.heapSize: 256 skin.dynamic: yes hw.device.manufacturer: Google hw.gps: yes hw.initialOrientation: Portrait image.androidVersion.api: 26
– Northwesthw.audioInput: yes image.sysdir.1: system-images\android-26\google_apis_playstore\x86\ tag.id: google_apis_playstore showDeviceFrame: yes hw.camera.back: emulated hw.mainKeys: no AvdId: Nexus_5X_API_26_No_Proxy hw.camera.front: emulated hw.lcd.density: 420 avd.ini.displayname: Nexus 5X API 26 No Proxy hw.gpu.mode: auto hw.device.hash2: MD5:1be89bc42ec9644d4b77968b23474980 hw.ramSize: 1536 hw.trackBall: no PlayStore.enabled: true hw.battery: yes hw.cpu.ncore: 4 hw.sdCard: yes tag.display: Google Play runtime.network.latency: none hw.keyboard: yes
– Northwesthw.sensors.proximity: yes disk.dataPartition.size: 800M hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes
and Android Studio 2.3.3 – NorthwestvrIntent.setPackage("com.google.android.googlequicksearchbox");
it then fails? – FeezevrIntent.setPackage("com.google.android.googlequicksearchbox");
it fails. I've tested also on a Mac OSX with Android Studio 3.0.1 and an emulator with API 27. Same behaviour. With the above line: OK. With the line commented out: KO. – Northwest