Android Studio- Play Sound on button tap WEAR - java

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.

Related

How do I make an overlay camera app for streaming with the phone on different platforms?

So I want to make in android studio (with java) and app that will add an overlay to my phone's camera where I can write anything (for example, the scoreboard of the game that I am filming) I want to be able to get this overlay working when streaming on social media (facebook, instagram etc).
I couldn't really find lots of resources regarding this idea.
Thanks in advance

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".

Camera intent open the camera app (only the first time)

Here is the context:
In my app, I need to capture images, that's why I use camera intent.
This feature works perfectly, but only if the camera app was already been opened once before
Indeed, this issue appears only on a new device, or a new emulator
Here is the problem:
When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures. That's not the camera app IN my app, but the camera app alone. I need to close this camera app, back to my app, and trying again
When I visit the camera app at least one time in the device's life, there is no issue
Here is what I'm looking for:
I want this camera app open in my app, even if it's the first time
I use the classic and official way to captures images
https://developer.android.com/training/camera/photobasics
EDIT
I think the problem is because at the first time, the camera app asked for the location permission. So we need to open the intent without asking this permission, to keep the focus
When I want to capture an image, the native camera app just open, giving to me some hints to how take pictures.
There are ~26,000 Android device models. These ship with dozens, if not hundreds, of different pre-installed camera apps. The behavior of any of those apps on first run of that app will vary by app. Moreover, the decision of how those apps behave when they are first run is up to the developers of those apps, not you or me.
That's not the camera app IN my app, but the camera app alone
It is never "IN [your] app" if you are using ACTION_IMAGE_CAPTURE, as your question suggests that you are. It is always a third-party app, one of many pre-installed ones, or one of the user ones. And, again, the behavior of those apps are up to their respective developers.
I want this camera app open in my app, even if it's the first time
Sorry, but that is not under your control.

Controlling media on one android phone from another

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.

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

Categories

Resources