Suppress Android incoming call Activity from appearing - android

How are things now
This has been discussed in many questions but neither one offers a good solution. Things look simple, after having a BroadcastReceiver is really easy to intercept and block a call. The main issue that appears is the default Android incoming call screen. You know, the one with sliders for answer/end call. Because i have some rules to block the call, there is a small delay before the call gets hangup. In all this time, the Incoming call screen is active.
How I want things to be
I want the user to not get notified by this call blocking, as in my application I have a clear Log of all blocks done. So, the main thing remains: how do I prevent the Incoming call screen from starting?

It is not possible to completely block the calls but you can achieve this by listening the call and then disconnecting it. It's behaviour may be different in different devices. It may show negligible flicker over some device but that's the only solution.
Here is the approach how you can do that:
Android: Taking complete control of phone(kiosk mode), is it possible? How?
You can use BroadcastReceiver but for alomost blocking experience you need to use Service.

Related

How to detect fake call log created by apps

Play store has numerous apps those creates fake call logs.But, sometimes it's important to detect is that call log real or fake to save yourself being a fool. Can anybody tell me how can we detect same?
If these apps are writing to the actual android call log, I don't think there is much you can do against that.
However, you might want to try the below solution, which can maintain your own call list based on the device behaviour.
In Android you can listen for incoming and outgoing calls, using a BroadcastReceiver. Here is a good tutorial for it:
https://www.codeproject.com/Articles/548416/Detecting-incoming-and-outgoing-phone-calls-on-And
If you implement it correctly, you will only receive events from calls being executed for real. So you can save them in your app's call log.

How do I know who ended the call in Android - User or Remote User?

I want to specifically know who ended the call. I have setup a broadcast receiver for
"android.intent.action.PHONE_STATE"
When I detect a transition from Off hook to idle, I know the call has ended. But how do I know who ended the call?
Thanks a ton!
I'm afraid there's presently no way to determine if the user pressed "end call" or if the other end (or ends, in a group call) terminated. The only workaround I can suggest is monitoring the other states to observe if the phone state ringing was encountered. In such a case, you could assume the user is making the phone call as opposed to receiving it.
Bear in mind that there are other problems related to PHONE_STATE, such as handling multiple calls simultaneously.
In retrospect, I'm not entirely sure what you mean with "who". As for other apps ending the call: there is no official API to end phone calls; only through reflection can an app invoke the TelephonyService's endCall() function. Here, too, it is not possible to determine if the call was terminated through user interaction or not.

Is there a way to know why your application was not given priority as a receiver

I'm trying to override the default incoming screen, something that I know is possible in all edition of Android as fullscreencallerid does it (and well).
If I register a receiver and start an activity, I successfully replace the view with my activity. If however I start filtering by EXTRA_STATE, the default incoming call screen appears.
I suppose what would help is somehow seeing what the hell is android thinking at that point, and why it preferred the default receiver.
Is there a way to trace application lifecycle, even if it involves some heavy tweaking (It's purely for learning purposes).
Thank you.

Show my activity instead of standard screen for incoming call

I'm developing an application for android 2.3.3. It contains a few EditView's to show an information for an incoming call: country, current time, phone number... I know how to get and show that information. The problem I faced is that I don't know how to show my activity instead of the standard screen for incoming calls.
Now it shows the information after the incoming calls.
How to do it?
It's not possible. According to the PhoneApp the intent used to start the InCallScreen is bound to the phoneapp, you have no chance to intercept this. So the screen will be shown every time.
What you may try to do is to be notified by the TelephonyManager when the phone goes into the CALL_STATE_RINGING state and then paint your UI just over the InCallScreen. It may be possible to do so but you woudn't be able to offhook the call (unsure, but I don't think so) from your UI. Also the state is not set immediately when the InCallScreen pops up, it's delayed by some milliseconds.
Take a look at the questions about showing popups over the incoming call screen:
Popup over incoming-call screen
android incoming call screen
If it isn't enough to show a popup over the incoming call UI, then you could make your popup cover the whole screen to hide it. At that point you'll need a way to accept the incoming call without showing the default incoming call screen (which you are now covering). A quick search found this answer that suggests a workaround to accept the incoming call. I'm not sure offhand if there is an official API to do it.
It's impossible to remove the default UI of the incoming call in android, unless you modify the Android OS codings. But instead you can use your own custom UI activity over the default one. It's attained by using the Thread concept(to make the custom designed UI come-over the default one)!!

android apps that alter normal phone operations

so i was wondering if its possible to for an application that i would write to be constantly running in the background and alter regular phone operations. For example this could be something like as soon as you receive a text from anyone you forward it automatically to another number. Is something like this at all possible?
Just to be clear I don't want to solve that particular problem through some other means, just want to know if apps can accomplish that.
Also if that is possible is it possible for an app that i write to alter more immediate and instant things, like an incoming call.
thanks all for reading this, and hopefully a helpful response :)
It depends on how far you want to go, but I would expect that what you want to achieve probably isn't possible.
The Android OS does reserve some actions and prevent them from being doing programmatically. For example, you can display the Dialer with a number filled in but the user has to press the call button to make a call. Similarly, you can display the SMS app with a message already written but it is up to the user to send the message.
I don't know for sure, but I assume this is for security. For example, let's imagine you could write an application which could start a call with no user interaction. I would release my Super-Handy-Dialer application which makes quick calls for you making you life easier, but what it also would do is wait until 2am and call my premium rate phone line every night for 3 hours.

Categories

Resources