10

In my android app I am using this intent to start fm radio

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);

Is it possible to set a manual frequency and open the fm radio? Thanks

Jonas
  • 121,568
  • 97
  • 310
  • 388
Amila Iddamalgoda
  • 4,166
  • 11
  • 46
  • 85
  • Currently this is a chipset. The the manufacturer of the chipset can supply this. Right now, Motorola/Lenovo is very open. The chip frequency range is 65 MHz to 108 MHz wideband FM only. RDS is ported from the chip as raw data and buffered. This is handset specific. The FCC might also be a good resource. Rudolph. – Rudolph James Robert Wratten Jan 25 '21 at 01:57

2 Answers2

8

There is currently no native Android API for playing FM radio.

You need to use 3rd party apps to play FM radio, and each phone vendor / app vendor has it's own API.

You best option is to contact them directly and ask for the relevant API to suit your needs.

Hope this helped!

gilonm
  • 1,829
  • 1
  • 12
  • 22
  • Can you please give me some APIs in details.I have searched some,but didn't accomplish my task :( – Amila Iddamalgoda Mar 26 '14 at 06:17
  • 1
    You probably won't find these API's online for free use seeing they are vendor spesific. It's like you ask for the API of Samsung's TouchWiz API or something :-) In other words, you probably won't find them for free on the internet, and you will have to write to the vendors, asking them to provide their API (If they are willing to do so at all)... – gilonm Mar 26 '14 at 06:20
7

I've decompiled FM Radio app, and I saw this code:

    void sendFMStatusBroadcast(float p1, String p2) {
        Intent localIntent1 = new Intent("com.android.fm.player_lock.status.channel");
        if(FMRadioProperties.getRegion() == 0x65) {
            localString2 = String.format("%.2f", Float.valueOf(p1));
            localIntent3.putExtra("freq", "%.2f");
        } else {
            localIntent1.putExtra("freq", p1 + "");
        }
        localIntent1.putExtra("name", p2);
        sendBroadcast(localIntent1);
    }

You should also decompile FM Radio app and search for intent in the Main Activity, and work with that code to get through your problem.

The Badak
  • 2,010
  • 2
  • 16
  • 28