安卓:您可以发送/接收数据沿phonecall? [英] Android: Can you send/receive data along a phonecall?

查看:158
本文介绍了安卓:您可以发送/接收数据沿phonecall?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一些数据传递给电话我打电话。 有没有什么办法可以做到这一点? 我真的不关心数据的类型(单位就足够了), 只要我能识别它,并触发特定的操作。

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.

发送code:

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

免费获赠code:

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");
    }
}

感谢

推荐答案

你在做什么有是不可能的。当你打个电话到另一台设备,它不一定要调用Android设备。要发送到呼叫意图布尔正在由这一意图阅读,而不是在呼叫发送到其它设备。

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.

如果您想将数据发送到另一个电话设备,您最多可以发送按键音。这些是由按钮presses发出的声音(所以,举例来说,如果你打电话你的银行,他们要求你preSS一为客户服务,二为电话银行等,这些关键presses发稍不同的音调沿着接收机regonises作为触摸preSS为一和二​​,所以可以执行一些动作的连接)。

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).

您需要发送按键音的电话,还可以处理在另一端recieving他们。正确的实施将使两个Android手机进行沟通,就好像发送数据。

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.

它们也通常被称为DTMF音调。

They are also commonly referred to as DTMF tones.

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

在code以上将发送DTMF音频与电话。

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

我不知道如何访问reciever设备上的音频流,所以你就必须寻找到这个自己,弄个流,并听取了DTMF音频。

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!

这篇关于安卓:您可以发送/接收数据沿phonecall?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆