android phone number verification using broadcast receiver - android

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.

Related

How to show ringing UI on mobile even if the app is killed and phone is locked?

I don't exactly know the flow of Video calling in mobile apps. The flow which I am using for video calling is as follows:
User 1 taps to call User 2
Your app generates a unique name for a Room. Perhaps a combination of the two user's IDs.
User 1 connects to Room with generated unique name
Using FCM or GCM, send message of high priority with the unique name of the Room and token to User 2
User 2 to receives notification and you display a ringing UI(even when the app is killed and phone is locked)
User 2 accepts and connects to the same Room
Now I am stuck on point 5. I am sending the FCM notification(which shows up in tray (edit: now using voip notif) to user2 and now I need to show ringing UI on user2's mobile even if the app is killed and phone is locked. How can I achieve this?

Android Block All Numbers Except Whitelisted

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.

Open app while specific phone number calls

I want to open or maximize app working in background while specific phone number calls. Is that possible?
Where can I find more info?
Use a broadcast receiver for reading the Phone state when you receive a call.Then if the phone number which you have received is specific then start an activity

SMS utility on Android 4.4 KitKat

Before KitKat was released I had developed an app which uses pre-defined short codes to perform transactions over SMS. For example, sending
"<PIN> BAL <phone number>"
would get you a reply with your credit balance. The user doesn't see the short codes, but instead picks the required function from a list, inserts his PIN and presses send. The message is formulated and sent by the app. The main point here is that his outgoing SMS (which contains his PIN) is not saved anywhere.
Since KitKat however, as long as my app is not the default SMS app, the outgoing SMS is saved in the default Messaging app. I can't ask users to set my app as default either, because it cant be used for normal messaging.
A solution or a workaround would be a lifesaver.
The main point here is that his outgoing SMS (which contains his PIN) is not saved anywhere. A solution or a workaround would be a lifesaver.
Forget it - there's no clean one. See docs:
Also, the system now allows only the default app to write message
data to the provider, although other apps can read at any time. Apps
that are not the user's default can still send messages — the system
handles writing those messages to the provider on behalf of the app,
so that users can see them in the default app.

MIT's App Inventor can't receive phone calls or show the calling number ... Is it possible?

It's possible to do many things in MIT's app inventor, yet, there is no clear way on how to receive a phone-call/SMS or even showing the calling number ... is that possible?
You can't receive a phone call with App Inventor, there is the PhoneCall component, but you can only Use this component to dial the phone and make a call.
There is the Texting component, which can send and receive SMS and also display the sending phone number: When a message arrives, the MessageReceived event is raised and provides the sending number and message.
Please see the reference documentation for more info.
http://ai2.appinventor.mit.edu/reference/components/social.html:
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. Using this block
will add dangerous permissions that will require additional approval
if your app is submitted to the Google Play Store.

Categories

Resources