I'm trying to pass some data to a phone I'm calling. Is there any way I can do this? I don't really care about the type of data (a single 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);
Recieve 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");
}
}
After turning off mobile data, you'll still be able to make and receive phone calls and get text messages. But you won't be able to access the internet until you reconnect to a Wi-Fi network.
Since the VoLTE service requires the 4G network, make sure that the 4G network you are using is functioning properly. If the 2G icon is displayed during a call and the Internet cannot be accessed after VoLTE is enabled, it indicates that the network provider's VoLTE network is abnormal.
Change the settings for Call & text on other devicesFrom Settings, tap Advanced features, and then select Call & text on other devices. When Use Wi-Fi only is turned on, Call & text on other devices will only work when the device is connected to a Wi-Fi network.
What you are doing there is not possible. When you make a phone call to another device, it isn't necessarily an Android device you are calling. The boolean you are sending to the call intent is being read by that intent and not sent to the other device in the call.
If you want to send data to another telephone device, you can send up touch tones. These are the sounds made by button presses (So for example, if you ring your bank and they ask you to press one for customer service, two for telephone banking etc, those key presses send a slightly different tone along the connection which the receiver regonises as being a touch press for "one" and "two", so can perform some action).
You would need to send touch tones to the phone call, and also handle recieving them at the other end. Correct implementation will allow the two Android phones to communicate, as if sending data.
They are also commonly referred to as DTMF tones.
Intent mIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber + ";" + dtmfSequence));
The code above will send the DTMF tones with the phone call.
I'm not sure how to access the audio stream on the reciever device, so you would have to look into this yourself, to get hold of the stream and listen for the DTMF tones.
Good luck, hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With