1

I am facing problem to work with VoiceInteractor. Here it my Manifest part:

<activity android:name=".ProductSearchActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.VOICE" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity>
    </application>

And in the Activity,

@Override
public void onResume() {
   super.onResume();
   if (isVoiceInteraction()) {
      getVoiceInteractor().submitRequest(new VoiceInteractor.PickOptionRequest(prompt, optionArr, null) {
                    @Override
                    public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
                        if (finished && selections.length == 1) {

                            showResult(selections[0].getIndex());
                        }
                    }

                    @Override
                    public void onCancel() {
                        getActivity().finish();
                    }
                });
   }
}

Whenever I am starting my app using "OK Google, search Jackets on MYCART", it starts the application, but isVoiceInteraction() is always returning false and getVoiceInteractor() is always returning null even if I am starting the app by google search. Can anyone help me on that?

dev_android
  • 8,698
  • 22
  • 91
  • 148
  • https://stackoverflow.com/questions/35642854/ok-google-search-actions-causes-isvoiceinteraction-to-always-return-false – AesSedai101 Nov 23 '17 at 06:58
  • 1
    NO, my app is starting voice search, it is published app in Google play – dev_android Nov 23 '17 at 09:32
  • 1
    hi dev_android, if we publish to play store , then only isVoiceInteraction() will be true? – adhi Jan 23 '18 at 08:42
  • Did you discover anything new on this? I published my app on Google Play (beta test channel), but still voice interaction is always false. – gregko Feb 04 '18 at 14:05

0 Answers0