Reputation: 8946
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
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:
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