Android Block All Numbers Except Whitelisted - android

I would like to block all numbers except for a select few whitelisted numbers on my Android phone.
In the Android docs I see that there is an API for blocking specific numbers. I was wondering if there is a similar more broad API which rejects all incoming communication unless a number is whitelisted.
Or perhaps an intent I could hook an app up to which would screen each number before ringing the phone.

Use a broadcast receiver to get the state when incoming call is coming.
Then in that event get the number of the caller.
Match the number with your list of numbers,if it equals your whitelisted one allow else disconnect the call programmatically.

Related

android phone number verification using broadcast receiver

I need to verify the mobile number the user is entered. For that , I am sending a message from his mobile to number he entered with some special code in the message body. I have registered a broadcast receiver for incoming messages and once I got the message I am verifying both the number and the special code. If both are matching , I am confirming mobile number is valid.
But, if user enters some other mobile number , the broadcast receiver for incoming message will not executed. What is the best way to handle this?
But, if user enters some other mobile number , the broadcast receiver for incoming message will not executed. What is the best way to handle this?
This depends on what precisely you want your verification to function.
If you want to allow verification via another device (e.g., your app runs on device A, user enters phone number of device B and receives message there) you'll have to provide a way for the user to manually input the received code.
Otherwise, if you require that the phone number entered is currently used by the device your app runs on you'll have to additionally implement error handling in your app. This is not restricted to users entering wrong/different phone numbers. Instead, you have to handle any case where you don't receive a message a certain time after the phone number was entered. Generally, you could prompt the user to enter the phone number again (instructing him to make sure that it belongs to the device) after some time. However, please also check that
You have successfully sent the message
The device can receive the message, e.g., airplane mode is not enabled
and act accordingly.

Is it going to be an Android service?

I am new in Android Development. I want to create an application which would add a prefix to a calling number and this decision will depend on some parameters.
I want an user to be aware of it but doesn't have to do anything about it, meaning once the application is installed and an user wants to call, they'll just see that a prefix is going to be added to a number they are calling.
The question is not how to do adding a prefix to calling number (although, that's also what I want to know, but I have found an article about it), but rather:
1) is it going to be a service?
2) is it possible to change a calling number by adding a prefix to it and show a changed number to an user so that they don't have to do anything about it (like pressing "yes","no" to accept this)?
You should register for Intent.ACTION_NEW_OUTGOING_CALL
Broadcast Action: An outgoing call is about to be placed.
The Intent will have the following extra value:
EXTRA_PHONE_NUMBER - the phone number originally intended to be
dialed. Once the broadcast is finished, the resultData is used as the
actual number to call. If null, no call will be placed.
It is perfectly acceptable for multiple receivers to process the
outgoing call in turn: for example, a parental control application
might verify that the user is authorized to place the call at that
time, then a number-rewriting application might add an area code if
one was not specified.
For consistency, any receiver whose purpose is to prohibit phone calls
should have a priority of 0, to ensure it will see the final phone
number to be dialed. Any receiver whose purpose is to rewrite phone
numbers to be called should have a positive priority. Negative
priorities are reserved for the system for this broadcast; using them
may cause problems.
Any BroadcastReceiver receiving this Intent must not abort the
broadcast.
Emergency calls cannot be intercepted using this mechanism, and other
calls cannot be modified to call emergency numbers using this
mechanism.
Some apps (such as VoIP apps) may want to redirect the outgoing call
to use their own service instead. Those apps should first prevent the
call from being placed by setting resultData to null and then start
their own app to make the call.
You must hold the PROCESS_OUTGOING_CALLS permission to receive this
Intent.
This is a protected intent that can only be sent by the system.
Constant Value: "android.intent.action.NEW_OUTGOING_CALL"

Monitoring the Activities of Android Devices

I want to develop an android application which allow to me to track and save into an online database the following information:
Incoming and outgoing call
Incoming and outgoing SMS
Keystrokes typed by keyboard
Questions:
How can I run my application in the background (must use service or thread)?
Is it possible to got incoming or outgoing calls with details
(phone number, date of call, call duration, etc.)?
Is it possible to got incoming or outgoing messages with details
(destination/origin number , message content)?
Is it possible to got all keystrokes typed by keyboard?
Do I need root access to do this?
How can I run my application in the background (must use service or thread)?
Use a service
Is it possible to got incoming or outgoing calls with details (phone number, date of call, call duration, etc.)?
Yes.
Is it possible to got incoming or outgoing messages with details (destination/origin number , message content)?
For incoming there is official SDK support. For outgoing, there are only unofficial methods.
Is it possible to got all keystrokes typed by keyboard?
This is impossible, unless you also wrote the keyboard app being used.
Do I need root access to do this?
No.

Intercept incoming flash messages on android mobile

can anyone help me to intercept the incoming Flash messages (specially the ones from the telecom company, where they send our current balance after some activity like message sent).
My application deals with sending SMSes in bulk and I don't want the flash message popping now and then. So is it possible on Android ?
EDIT: Everyone says its not possible above Android 1.6 but I found a similar App on Google Play but I want the source of that kind of App. Please Help.
Edit: More than a year has passed and still I didnt got the solution. Can anyone help to resolve this thread..??
Might depend on the channel [of communication] used by your service provider. I guess they don't use SMS, probably they use WAP/PUSH or some pre-installed provider app for the notifications, which makes this harder to block. If it was SMS, you'd definitely have lots of ways to block their notifications, but in this case, I doubt there might be an easy / direct way to do this.
Flight Mode should ideally block telco / service-provider messages / notifications, but then this also blocks your connectivity, right? So, am not so certain on this one. Isn't there a way to opt-out of service provider notifications, maybe via a ussd routine? I've heard of this once...
Flash sms it is the same as usual sms except data coding flags. It has "class 0" indication in DCS.
For details about sms coding see: GSM 3.38 specification / 4 SMS Data Coding Scheme.
Some fragment from spec about it
When a mobile terminated message is class 0 and the MS has the capability of displaying short messages, the MS shall display the message immediately and send an acknowledgement to the SC when the message has successfully reached the MS irrespective of whether there is memory available in the SIM or ME. The message shall not be automatically stored in the SIM or ME.
So, in most cases, phone just displays this message and skips usual chain of actions.
Probably, you can't catch this message with usual API... probably you need deep hook and rooted device.
[Or may be just switch off this service by calling customer support?]

How to suppress android system popups for outgoing sms notifying user's current account balance for a pre-paid network plan?

My app is able to successfully intercept incoming SMS with a special code. Increased the priority in the manifest intent filter to suppress the broadcast for such special messages using abortBroadcast(). On receiving such special sms the app is supposed to send back an SMS with some info(lets say current location). I have been successfully able to achieve this as well.
The problem is, few of my customers might be on a prepaid plan. This means everytime they send an sms, a system popup comes up telling the remaining balance in their account.
Suppressing the incoming sms broadcast has solved half the problem because my customers dont want to receive these special sms in their inbox nor they want the notification. The problem that remains is how to suppress the outgoing "remaining balance" system popups? Is there a way(for non rooted android) to suppress these notifications?
One way is yes go to setting and manually disable it. That will disable it for all outgoing sms. I dont want my users to do that. I want to programatically suppress only those popups that are a result of sms sent by my app.
I am trying to add this feature for a legitimate use and my customers will be aware of this behavior. I am ok if the customer has to agree to any such settings during the install time(just like device admin policy manager or other usual app permissions).
Any suggestions?
I installed Balance Update / USSD Blocker from Play Store.... so far seems to be working. Available here
https://play.google.com/store/apps/details?id=com.melkote.quietbalance
Is there a way(for non rooted android) to suppress these notifications?
AFAIK, there is nothing in Android for this. Most likely, this popup was added by device manufacturers and carriers for their specific plans. You are welcome to talk to each device manufacturer and each carrier to determine if they offer any sort of API for adjusting this behavior.

Categories

Resources