Android: Can you send / receive phone line data?

I am trying to transfer some data to the phone that I am calling. Is there any way to do this? I don't care about the data type (just one bit is enough), as long as I can identify it and trigger a specific action.

Send code:

Intent call = new Intent(); call.setAction(Intent.ACTION_CALL); call.setData(Uri.parse("tel:" + contact.getNumber())); call.putExtra("Boolean", true); startActivity(call); 

To get the code:

 public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { if (extras.getBoolean("Boolean")){ Log.d("BOOL", "true"); } else { Log.d("BOOL", "false"); }else { Log.d("BOOL", "nothing"); } } 
+8
android phone-call
source share
1 answer

What you do there is impossible. When you make a phone call to another device, it is not necessarily the Android device that you are calling. The boolean value that you send to the call intent is read by that intent and is not sent to another device in the call.

If you want to send data to another telephone device, you can send tones. These are the sounds made by pressing the buttons (for example, if you call your bank and they ask you to press one for customer service, two for telephone banking, etc., these keystrokes send a slightly different tone to the connection that the regenerator regonizes as touch press for "one" and "two", so it can perform some action).

You will need to send sensory melodies to a phone call, as well as process them at the other end. Proper implementation will allow two Android phones to communicate as if they were sending data.

They are also commonly called DTMF tones.

 Intent mIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber + ";" + dtmfSequence)); 

The code above will send DTMF tones with a phone call.

I'm not sure how to access the audio stream on the receiver device, so you will need to learn this yourself to get the stream and listen to the DTMF tones.

Good luck, hope this helps!

+7
source share

All Articles