Is it possible to detect a Whatsapp voice call ended in Android? - android

I would like to listen when Whatsapp voice call ended.
If the app was granted to access notification listener, I can detect an incoming WhatsApp call by parsing notification data but there are no data when a call ended.
So is there any solutions for this case? Thank you.

You can also detect if the call is ongoing... because the notification will be posted to the listener every second ( Because the call duration info in notification changes
every second ) until the call ends. Just start a timer process to detect the last time a WhatsApp call notification was detected , and if the time is greater than 3 seconds, you can declare that as an ending of a call and run your code there.

Related

App Inventor 2 Activity Starter

I'm making an android app and I want to know if is there any way to:
Reject/Answer the incomming call ( I just need a function line. Something like this example "android.bluetooth.adapter.action.REQUEST_ENABLE" but of course I don't mean bluetooth. )
Get the text of incommig SMS and store it in text variable.
I'm almost sure the first point is doable by activity starter but I can't figure that out.
You can't do this with the Activity Starter.
Please take a look at the documentation about the PhoneCall component and the Texting component.
For the PhoneCall component there are the following events available:
IncomingCallAnswered(text phoneNumber)
Event indicating that an incoming phone call is answered. phoneNumber is the incoming call phone number. PhoneCallEnded(number
status, text phoneNumber)
Event indicating that a phone call has ended. If status is 1, incoming call is missed or rejected; if status is 2, incoming call is
answered before hanging up; if status is 3, outgoing call is hung up.
phoneNumber is the ended call phone number.PhoneCallStarted(number
status, text phoneNumber)
Event indicating that a phonecall has started. If status is 1, incoming call is ringing; if status is 2, outgoing call is dialled.
phoneNumber is the incoming/outgoing phone number.
to reject/answer an incoming call is not possible with App Inventor.
to get the text of an incoming SMS is easily doable, but your App Inventor app must be up and running. Just use the MessageReceived event, see also the No Text While Driving tutorial.
First do the tutorials to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

android.intent.action.BOOT_COMPLETED - do not receive broadcast if boot completed by a phone call

I am using a broadcast receiver in my app, to display a photo on BOOT_COMPLETED. However, I noticed that if I receive a phone call on my phone, the photo is displayed in front of incoming phone call activity, so I can's see who is calling me and what is worse - can't answer the phone.
What is the best way to override this behavior?
you could add another mechanism for listening to phone calls events, and if you detect that the phone is ringing (or the call was answered), you won't show the activity...
in any case, please don't show such things. no user likes popups go out of nowhere.
instead, use notifications to tell the user something has happened.

Send a Voice data During A call

Am in the feasibility study of an app which enables an automated message like, "I'll pick up the call in a second. Please wait.” or so as the user sets, without hanging up the call. So as to enable the user to get time to pick up the call if in case he is busy and also alerts the caller to be patient till the phone gets picked up.
The problem is I want to send it as voice data. Is it possible to send without attending or hanging up the call? Is it possible to send a voice data not as MMS!!!?????
According to what I suggested..
1>Pick the call intent when actually you got the call on you phone
You can find the helpful links over
here,
here
and here
2>have some prerecorded MMS or some SMS.
3> use threads sleep method to wait for some time(the time after which you actually want to send the informatory message to the caller).
4> do your job here to send the message to the caller in the background thru ur app.

Android notify the user at a later time

I want to create an application in android in which the user selects a certain day in the future and then, when that day arrives he will get a notification (I know that this can be done through the Calendar or the notes but that doesn't matter in my case).
I have two problems concerting the previous:
a. How should I implement the notification ? I read elsewhere about adding events to the Google Calendar of the user - but that is not standard. Should I implement a service that checks to see if that day has arrived and add the notificatin ?
b. As I wrote, I care about day only, and not time. This generates the following problem for me: When should I notify the user in order to not bother him ? When the application knows only the day of the notification (and not the time) then how can it determine at what time in that day to actually notify the user ? What if the user is asleep ? Is it possible to add a "silent" notification so that the user won't be bothered ?
TIA,
Serafeim
Both problems are solved by a 'status bar notification'
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
You can add a sound to this to alert the user.
If the user is 'asleep' i.e. the phone is on silent I believe the notification won't make a sound.
A notification does not need a time of day as you can 'notify' at the very start of the day and the user will see it when they first check there phone that day, so time is irrelevant.
You will have a service that runs to check the data yes, then start this notification. It may be possible to have an event listener for some given event that would start your service that would then check the date, and if so post your notification!
Here is my tutorial on this:
http://blog.blundellapps.com/notification-for-a-user-chosen-time/
Enjoy!

Kill app on incoming phone call

Hopefully an easy one for someone, but causing me problems.
I have an app that loops sound files. I have no code in onPause as I want the app to continue playing music in the background.
I now need the app to close if an incoming call is received.
I can add code to onPause and close the activity and stop the mediaplayer. However this stops the app if any app is launched.
How can I detect an incoming call to check for inside onPause?
To detect the incoming call, we register a BroadcastReceiver for the
action android.intent.action.PHONE_STATE. This will be broadcasted
when there is a change in phone state. The receiving intent will have
an extra string variable TelephonyManager.EXTRA_STATE which describes
the phone state. If this state is TelephonyManager.EXTRA_STATE_RINGING
then there will be another extra string variable
TelephonyManager.EXTRA_INCOMING_NUMBER. This variable contains the
incoming phone number. Note that this variable will not be present
when the state is not TelephonyManager.EXTRA_STATE_RINGING.
source : http://www.androiddevblog.net/android/detecting-incoming-and-outgoing-calls-in-android
basically, once you register a broadcast receiver you can listen for the broadcast notification you are interested in your phone, and then act accordingly.
You do not have to. Android takes care of it pausing your app - you have to use telephony manager to determine whether to stop your aplication or not. Proper way would be to handle this in onPause() method

Categories

Resources