Greg
Greg

Reputation: 357

Is it possible for an app to not work properly in different devices even though they run the same OS version?

I am building an app that includes a Speech To Text activity. I have tested it in a Xiaomi Pocophone F1 and a Samsung Galaxy A50, both running android 9 Pie. The F1 runs the app great, the A50 runs the app partly, but when attempting to use the Speech To Text option it just crashes. Is it that the device does not support that feature? i can't believe that... Anyway, i need a way to prohibit the user from attempting to use that feature on a Galaxy A50, so the app will politely say that it cannot happen instead of crashing.

Upvotes: 1

Views: 103

Answers (1)

The.Laughing.Man
The.Laughing.Man

Reputation: 549

Yes. Most Android operating systems provided by cell phone carriers are custom. They take the Google version of the OS and pile in all sorts of add-on apps and services (bloatware) that can impact other systems. This can cause minor differences between devices with the same OS.

Couple that with hardware differences that also impact how a device performs and handles input, and you can easily get circumstances where one device will not behave the same as another even though running the same OS version.

For you specific problem, you can see if the speech to text is available:

// Check to see if a recognition activity is present
PackageManager pm = getPackageManager();
List activities = pm.queryIntentActivities(
  new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
  speakButton.setOnClickListener(this);
} else {
  speakButton.setEnabled(false);
  speakButton.setText("Recognizer not present");
}

Code pulled from another stack overflow question: How to detect if speech to text is available on android?

Upvotes: 1

Related Questions