Controlling media on one android phone from another - java

I'm building a custom device. It runs android(rooted/configurable).
What I want to do is this: when my device is paired to your phone, it can accept/reject calls, control music(Volume +/-, next song, play/pause etc).
I don't want the audio. The audio plays from your phone itself. I just want to control the calls and the music. I have been reading up a lot on Bluetooth and profiles. And I'm not sure if there is a right one out there for me. Also it would be more helpful, if i can do all these functions without an app. That is i just pair the devices and they work. Hoping someone can help me whit this.

Related

Activate speakerphone on Android 10 and above

So, I'm working on this app where a phone call is made using the TelecomManager and I want to turn on the speakerphone programmatically when an event is triggered in the app.
The app is primarily not made for making phone calls etc, but there's a function that makes phone calls in certain events.
This works fine on android versions below android 10 using the following code:
AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
am.setMode(AudioManager.MODE_IN_CALL);
am.setSpeakerphoneOn(true);
am.setStreamVolume(AudioManager.STREAM_VOICE_CALL, am.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL), 0);
But this code doesn't seem to work on android 10 and above.
One solution is to have the speaker on by default when making the phone call, but I want to be able to toggle the speaker via events in the app.
Does anyone have a solution for this?
Edit:
The application is only making a call to a specific number in case of an emergency and is not a phone app. And I'd like to be able to start the speaker without having to make the app into the "Default Phone App".

Android Studio - Route all audio from phone (calls, music player, etc.) through App

I've made an app in Android Studio which is essentially a parametric EQ with some additional features.
The app takes signal from the microphone source (whether the built-in mic or external mic). The signal is then passed through biquad filters and out to the speakers/earphones. I used LibPb to handle the signal processing.
Now, I want all the audio that would be coming out the speakers to be routed through the app.
In other words, any music playing or calls, I want the audio to also be passed through the filters in my app.
I have tried to find articles/resources on this topic but haven't found much.
I'm guessing that it can be done via Audio Focus or Media Router or something along those lines, but I cant figure it out!!
Firstly, is this possible?
Secondly, any code or hints as to how to go about it?
Any help is much appreciated!!

Android Studio- Play Sound on button tap WEAR

I am making an app for Android Wear Devices that don't have speakers. For now I am testing. How can I make it so when you tap "button1" it does said function that plays, say an MP3 file FROM THE PHONES SPEAKER.
You'll need to build out a companion phone app to play the sound, and trigger it from Wear, probably using the Message API. The FindMyPhone sample (linked from that doc page) is probably a good place to start, as it's doing something quite similar to your requirements: playing a sound on the phone, triggered by an action on the watch.

how to record multiple sounds in musical application android

I am developing a musical piano app for android, in this app i want to record sound which user play by clicking piano buttons. I am using soundpool to play piano sounds. now for recording android gave us two api's MediaRecorder and AudioRecorder. but for both we have to set MediaRecorder.AudioSource. i didn't want to record sounds from mic because user sound can be included and more important sound quality decrease in recording. then i try to read bytes of that resource file which is played on clicking piano app. and when user click again and again then bytes will be together in global byte array. but when i play global byte array then this play only one resource file and one time only.
More important thing is i am new to android development. kindly guide me.
Although i did not find answer of my question, but now i am using technique for recording aspects which i want to share with all of you. Above function which i try to use is totally wrong option when you are trying to save music created by your app at run time. now for my first version i just saving the clicks of piano buttons along with system time in an array. now when i play that clicks it will play same sound as user try to record. i save these notes in database for further reuse by users.although this is not solution because these notes will be played in our app only, but this is good feature which we can add in our app. when i solve the correct solution, i will share with you guys

Send System Wide Key-press Android

I'm trying to learn more about Android development, and I think I have hit a tough patch. Basically, I want to be able to send a "fake" key-press to the entire android system. For example, lets say I have my music player going and I want to pause the music. I should be able to send:
KeyEvent eventPause = new KeyEvent(KeyEvent.KEYCODE_MEDIA_PAUSE, KeyEvent.KEYCODE_BACK);
System wide so it will stop/pause what ever media event is playing. The problem is, I keep finding things online about an instrumentation class, and some other weird classes that I either will have trouble compiling or has been taken out of the android API.
Does anyone know a way I can do this? I have a rooted phone, so a solution that requires root is perfectly fine for me.
Thanks!

Categories

Resources