Skip to content

Commit

Permalink
CATROID-1413 Fix GMS Speech Recognition on Huawei Phones
Browse files Browse the repository at this point in the history
Fixed GMS for the StartListeningBrick on Huawei phones.
The applied fix should be removed as soon as HMS is properly integrated and working.
  • Loading branch information
bigsmallpp authored and Max Oberaigner committed Jul 18, 2023
1 parent 0d6ab0a commit 932feb3
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,18 @@ public Action createOpenUrlAction(Sprite sprite, SequenceAction sequence, Formul
}

public Action createStartListeningAction(UserVariable userVariable) {
StartListeningAction action = Actions.action(StartListeningAction.class);
action.setUserVariable(userVariable);
return action;
// This is a fix to get the StartListeningBrick to work on Huawei Phones,
// can be changed once HMS is fully implemented and working
// As soon as this is the case, remove the if-statement and only use the else-branch
if (get(MobileServiceAvailability.class).isHmsAvailable(ProjectManager.getInstance().getApplicationContext())) {
AskSpeechAction action = Actions.action(AskSpeechAction.class);
action.setAnswerVariable(userVariable);
return action;
} else {
StartListeningAction action = Actions.action(StartListeningAction.class);
action.setUserVariable(userVariable);
return action;
}
}

public Action createSetListeningLanguageAction(String listeningLanguageTag) {
Expand Down

0 comments on commit 932feb3

Please sign in to comment.