Process Globals
Private NativeMe As JavaObject
'...
end sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer.
'...
If FirstTime Then
NativeMe.InitializeContext
End If
end sub
Sub ShowSoundSettings
#if java
/**
* Open speech recognition settings activity
*
* @return true in case activity was launched, false otherwise
**/
import android.content.Intent;
import android.content.ComponentName;
public boolean openSpeechRecognitionSettings() {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
boolean started = false;
ComponentName[] components = new ComponentName[]{
new ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.settingsui.VoiceSearchPreferences"),
new ComponentName("com.google.android.voicesearch", "com.google.android.voicesearch.VoiceSearchPreferences"),
new ComponentName("com.google.android.googlequicksearchbox", "com.google.android.voicesearch.VoiceSearchPreferences"),
new ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velvet.ui.settings.VoiceSearchPreferences")
};
for (ComponentName componentName : components) {
try {
intent.setComponent(componentName);
startActivity(intent);
started = true;
break;
} catch (final Exception e) {
/** Timber.e(e, null); **/
}
}
return started;
}
#end if
Try
Dim res As Boolean
res=NativeMe.RunMethod("openSpeechRecognitionSettings", Null)
Log("Launch result was " & res)
Catch
Log(LastException)
End Try
End Sub