[Q] Trigger a method when the phone conversation starts - Android Software Development

My program is to record the details of phone conversation. I would like to ask how to make my program keeping active all the time when the phone is on.
I would also like to trigger some methods when a phone conversation starts, anyway to do that?
Thank you.

Have you looked at the TelephonyManager class and specifically, implementing PhoneStateListener()?

Related

Software to answer phone through voice commands

I had an idea to write some software that would monitor when a phone call game in, and then (using the mic) try to see if I wanted to answer the phone by saying something like "Answer Phone". What the software would do is answer the call, set the volume to max, and switch on SpeakerPhone, (and probably immediately turn OFF the screen)
The principle being that if I'm driving and get a call I can answer it without reaching for the phone, (and without having a handsfree earpiece type setup).
Usually though, when I think of something like this, someone has already done it better, :wink: , so I was wondering, before I embark on this if someone knows any software that does this already?
PS: MS VoiceCommander will not answer the phone without hitting a button....
Sounds like an excellent program. Program away!
So I've got about 80% of this program done, but have hit a big snag.
How do you turn the LoudSpeaker on in software?
I thought I would just send a keybd_event(VK_F3, 0, 0, 0); for about 4 seconds, but this doesn't work. It answers the phone, but it does turn on the loudspeaker. Though if you phyically hold the talk button down it does turn on the speakerphone!
the Callback for PHONESTATE will tell me when its on, but how do I set it?
Any help?

I got VoiceCmd to not Hang after call with some BT Headsets!

Hi,
Was playing around with a way to get my Motorola H700 to not hang after the first use. I don't know how to code (at all) but I wrote a little VB app that Monitored the State and Notification PhoneCallTalking to see when a call was initiated, then monitored to see when the call ended at which point I executed BTAudioOn.Exe from BTUtils causing the channel to open again so I push the button and that's it, I could make call after call just like my old HS850. This will probably work with any headset that hangs after the first call.
Only problem, like I was saying, I can't program, I did all this in Do While Loops so it's pretty unusable since it kills the processor. I don't know how to work with Events or Registering for notifications.
Anyways, if there is anyone who can code and is looking for something to do, maybe you could make something similar (this way or a better way) that can run resident and monitor for the end of a phone conversation and then execute BTAudioON.exe or I guess if you know how to program the MS Bluetooth Stack, open the channel again.
If not, I guess I'll keep learning and try to figure out how to do it properly by handling the notification trigger and wait for it without killing the CPU
I've been looking for something like this! Keep us updated if you find a way to do it without putting too much of a load on the CPU.. I'm getting into WM programming but I have no idea how to capture call/notification states yet.
Re: I got VoiceCmd to not Hang after call with some BT Heads
shoey5 said:
Hi,
Was playing around with a way to get my Motorola H700 to not hang after the first use. I don't know how to code (at all) but I wrote a little VB app that Monitored the State and Notification PhoneCallTalking to see when a call was initiated, then monitored to see when the call ended at which point I executed BTAudioOn.Exe from BTUtils causing the channel to open again so I push the button and that's it, I could make call after call just like my old HS850. This will probably work with any headset that hangs after the first call.
Only problem, like I was saying, I can't program, I did all this in Do While Loops so it's pretty unusable since it kills the processor. I don't know how to work with Events or Registering for notifications.
Anyways, if there is anyone who can code and is looking for something to do, maybe you could make something similar (this way or a better way) that can run resident and monitor for the end of a phone conversation and then execute BTAudioON.exe or I guess if you know how to program the MS Bluetooth Stack, open the channel again.
If not, I guess I'll keep learning and try to figure out how to do it properly by handling the notification trigger and wait for it without killing the CPU
Click to expand...
Click to collapse
Good luck and keep us posted. One "use case" to keep in mind is if you initiate VC which doesn't lead to a phone call since VC supports other commands.
I tried something similar to what you are trying to do and it's just too complex because of the different outcomes of initiating VC
I think it'd probably be best to just fix the dialing part - I don't really care about the launching of the apps, etc.
Some of the voice commands, like "What day is it" didn't seem to break the voice channel anyway.
I hate to say it, but it's probably best to just fix the simple stuff and wait for a BT enabled version from Microsoft to fix the rest.
VCBTFixer - My First Attempt
Hey guys here's what I came up with so far. It's not much but it works, been using it all day without ever taking my Wizard out to reset the headset
When running in the background, it will monitor for a hangup (the point where your headset usually crashes after the first call) It will wait a second and then open the BT Audio Gateway, just press the BT headset again to turn it off, and then press it one more time and you'll hear VoiceCommand waiting for you again
Ok remember this is my first attempt at programming so use it at your own risk And remember it's not 100%, I still have to check for a failed call or if you terminate before the call actually starts, check to see if the headset is being used before trying to turn on the audio gateway ect.
I'll probably get rid of the dialog or keep it, I don't know, I was thinking it could be useful to configure a sound that can be played when the audio gateway opens again, this way you get reminded to press the headset button again to turn off the BT Audio Gateway Maybe display and allow you to select which headsets (if you have more than one) this program should work with if some work and some don't, all that kind of crap.
Anyways, let me know if it works.
Im no WM programmer but cant u open the BT channel then close it again pro grammatically, or will that cause the same type of "crash"? I would love to see this work because I WANT my damn H700 back, till then I'm stuck with this hs850.
Thanx; Lew
lewcamino: Tried that but it still hung, only way I could get it to work is to open the chanel and then close it. Anyways I tried this program with my H700 and it worked, give it a try, you have to be logged in to see it.
I'm no programmer either, maybe someone could write a much better version. I think the best way (if it's possible) would be to close the BT Audio Gateway just before VoiceCommand started dialing (the phone should open the Audio Gateway when the call starts and then it should be good (I think) but I don't know if that's even possible to detect.
So for now, until someone figures out a better way or Microsoft releases a new version with BT support, I guess this works. Used it all day with my H700 didn't have to push any buttons on the device between calls which is what I wanted.
Thanks shoey5! Your program works great with my H700.
Do you have any updates? Also, how did you create the .exe? What tools did you use? Are you willing to give up your source code? I would love to dig into it, modify it, upgrade it.
Again, thanks for the great program.
Congrats on getting something to work. What happens if you close the boom of the H700 after a call? What if you use VC to check your battery signal or ask what time it is?
Looking forward to seeing future versions - once it's good and ready I can go back to my H700. Using the HS850 for now.
Ok Second Attempt, if learning VB.Net for the first attempt wasn't bad enough, had to start learning C++ for the second
This one is a lot better though it's late so I haven't been able to test and it needs some error checking but it's much more useable. Ported it to C++ so now only takes 3.90K as apposed to the 200K VB.Net (Sucks) version was taking so it's acceptible to have it running in the background. Also uses a different method of refreshing BTAG after a call though I'd like to find a better way. Also got rid of the UI so you can throw it into \Windows\Startup to have it running when device loads.
Let me know how well or how bad it works.
Cool - thanks a lot! This seems to work!
Doesnt work with german rom... are there any paths hardcoded which may be named different in other languages? (Programs for example)
Hi Shoey5,
Just for your information I have a O2 XDA Mini S WM5 and it does not work as intended, works once after that it needs a soft reset.
I send you a PM with contact details.
Shoey,
your little app works really well! Only occasionaly will there be some kind of hiccup between the MDA and the headset, and I will have to reset the MDA.
It also seems that you have to be alittle patiend between calls to give the headset/MDA time to be ready to respond.
I can make repeated voice commands and even activate redial with a double tap on the headset button.
I would encourage you to keep working on this program so the VCBT functionality can be made even more stable!
Shoey,
your little app works really well! Only occasionaly will there be some kind of hiccup between the MDA and the headset, and I will have to reset the MDA.
It also seems that you have to be alittle patiend between calls to give the headset/MDA time to be ready to respond.
I can make repeated voice commands and even activate redial with a double tap on the headset button.
I would encourage you to keep working on this program so the VCBT functionality can be made even more stable!

[coding] 'Beep' during phone call

Hi,
I've been trying to create a "Beep" (or any other audible tone) whilst in the middle of a phone call programatically - however have been unable to do so.
Is there a way? I thought simulating a keypress (to generate a DTMF tone) would work, but if I send a keypress to Phone app, the other end of the phone call 'hears' the DTMF tone however it is not heard on the local handset.
Any help would be greatly appreciated.
I'm not sure if the problem is the same, but according to many in house investigation, there isn't a way of tagging onto a phone conversation (especially in-voice), so chances are, you may not able to get your beep through other than the default key press on the keypad.
There are several investigation on this. You can search around this forum.
(1) building a phone answering machine (popular one) - require to tag onto the in-voice data
(2) building a music sharing software (out-voice), and background noise emulator (e.g. to pretend to be at somewhere else).

Caller ID via Phone Vibrate/"Morse Code"?

The idea is that I often want to know who is calling even if I can't hear the ringer or have it on mute. I wanted to assign a few "code vibrations" to a few certain callers from the caller ID. For example, work would be a 3 long vibrations, my girlfriend would be two shorts then a pause then two shorts again. Etc, etc.
I started this project as a SKSchema script but never finished it then lost the source after a hard reset (stupid, stupid). The biggest issue with the script was that I had it set to run from a watch (phone ring). Every time the phone rang it would start the script again, instead of running only after the first ring. I hope that made sense.
Anyway, I have no time to finish this so I thought I'd put the idea out into the wild and see if anyone is interested in making it work.

Call notifications (+ accept and reject) on smartwatch with call sound on phone

Hi all,
So my issue was that I want to be able to receive phone call notifications and the ability to accept or reject those calls on my no.1 s9, but i don't want to use the watch as hands free. I've googled it for some time but i haven't found nothing to solve this.
It may sound silly but I believe that this should be implemented through options on smartwatch or even better, if you accept the call in the watch it redirects the sound, if you answer through your phone it shouldn't redirect).
I believe that with some other smartwatches this is the behavior but not with no.1 s9 and, maybe, with some other phones. The reason is simple: you have your phone on your backpack or in your coat, you can check who is calling and then you decide if it's worth to pick up your phone or not.
So, i have created a simple flow with Automagic to handle things just how I believe they should be. Well, not quite because with this flow you can not use your smartwatch as hands free. But if you want to do so, you just have to switch off the flow.
You can find the flow in the attached image.
The idea is simple, the flow is activated by InCallActivity, first thing is to ensure that you can choose what action to take on your watch so while it stills ringing nothing is done (maybe there is some other way of doing this... i don't know how so there is a condition that basically does nothing while true). when you choose what to do the flow moves on to the next step (well... if you reject the call in your watch nothing is done and the flow ends here). If you answer the call, it checks if the watch is connected and if so, disconnects the watch and sets Bluetooth off to prevent that your watch connects again and the sound is, once again, redirected. Here you find another condition that basically holds everything until your call finishes. After all of this, Bluetooth is turned on so that your watch connects again.
It's my first flow with Automagic and this means that maybe I have take some paths that are not the most correct ones but it works.
I'm still testing but tests made so far are giving the exact result that I was looking for.
If you have the same problem that i was facing please share your thoughts and what are the ways you're handling this.
PS: It works for outgoing calls also.
PS2: English is not my native language... sorry if there are some mistakes
Hi,
Nice idea!
Any progress so far?
Nenad

Categories

Resources