Applications that use Android earphones

Asked 1 years ago, Updated 1 years ago, 130 views

We are currently producing an application using earphones in Android Studio.

By the way, I found related materials that use earphones and coded them

Recognize the HEADSETHOOK button and float it on toast.

If successful, we're trying to implement features.

The functionality is not actually implemented.

I put permissions related to MEDIA_BUTTON and HEADSET_PLUG in Manifest

I've also put broadcast receivers in with the Intent Filter.

Also, in the main activity, they raise the ranking through IntentFilter.setPriority.

I thought I looked everything up, but it still doesn't recognize me.

Is there anyone who has worked on a project or knows about this?

Anyone who has succeeded?

android application software_development android-studio

2022-09-22 21:14

1 Answers

It would be better to refer to the code of music-related apps released on GitHub. I want to write a sample code myself and test it, but I couldn't check it because I didn't have earphones. However, since many apps are using the buttons on earphones, it would be more helpful to look at the code of the project that actually works on GitHub rather than fragmented code fragments. (See the code on the link below)

MusicDNA - https://github.com/harjot-oberai/MusicDNA/blob/50f19802c5e86fc57b45f1bcf433b19cc27c09ea/app/src/main/java/com/sdsmdg/harjot/MusicDNA/HeadsetHandler/HeadSetReceiver.java

Timber - https://github.com/naman14/Timber/blob/3aff0b01860c9966433f4234e03d53db31774207/app/src/main/java/com/naman14/timber/helpers/MediaButtonIntentReceiver.java

In addition, (I think you already know) the media button on Apple earphones does not work on Android devices. I think we need to do a pre-test to see if the earphones we are testing work well in the same place as the basic music app. :)


2022-09-22 21:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.