John
John

Reputation: 8946

opening fm radio from the android application

I am developing an application in which i need to open FM radio installed in the device. that is only "FM radio" not "internet FM radio".

i know how to open another application using intent

 Intent i = new Intent(Intent.ACTION_MAIN);
 PackageManager manager = getPackageManager();
 i = manager.getLaunchIntentForPackage("com.sec.android.app.fm");
 i.addCategory(Intent.CATEGORY_LAUNCHER);
 startActivity(i);

But i need the package name of the fm radio application in every device, Is there any way i can query for package name and open the fm radio application.

For now i am using samsung galaxy S..the fm radio package name in this device is

com.sec.android.app.fm

Is this package name will be same for every android devices.

Any one please help..

Upvotes: 5

Views: 5358

Answers (1)

jclehner
jclehner

Reputation: 1460

CyanogenMod uses com.android.fm for example. I'm not sure about other vendor-specific radio apps, but I'd say their package names are very likely to differ.

Right now two, not necessarily mutually exclusive options come to mind:

  1. Using a heuristic approach to gather likely candidates for the radio app's package name*
  2. Requiring the user to choose the radio app from a list of all installed packages

If your app has internet permissions, you could also collect the package names discovered using either method to compile a static list of package names to be included in your next release, in the hope of relieving new users from having to manually select their radio app.

*) Using PackageManager.getInstalledApplications(...) and scanning the returned List for occurrences of ".fm.", ".fm", etc., you might be able to get a list of possible candidates.

Upvotes: 4

Related Questions