如何使用Android智能手机用数据线发送短信? [英] How to send SMS using android smart phone with data cable ?

查看:58
本文介绍了如何使用Android智能手机用数据线发送短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有我已经在使用诺基亚手机的命令使用代码通过使用数据线发送短信作为现在一天智能手机必须所有人然后请任何人帮助我或指导我如何通过Android手机发送短信< br $> b $ b

我的尝试:



Dear All I Already Using a Code With At Command With Nokia Phone For Sending SMS by Using Data cable As Now A Day Smart Phone Have to all Person Then please any one help me or Guide me How To Send SMS By Android Phone

What I have tried:

public class CommSetting
{
    public static int Comm_Port=0;
    public static Int64 Comm_BaudRate=0;
    public static Int64 Comm_TimeOut=0;
    public static GsmCommMain comm;

    public CommSetting()
    {
        //
        // TODO: Add constructor logic here
        //
    }
}




GsmCommMain comm = new GsmCommMain(port, baudRate, timeout);
try
{
        comm.Open();
        while (!comm.IsConnected())
        {
            Cursor.Current = Cursors.Default;
            if (MessageBox.Show(this, "No phone connected.",
               "Connection setup", MessageBoxButtons.RetryCancel,
                 MessageBoxIcon.Exclamation) == DialogResult.Cancel)
            {
                comm.Close();
                return;
            }
            Cursor.Current = Cursors.WaitCursor;
        }

        // Close Comm port connection (Since it's just for testing
        // connection)
        comm.Close();
}
catch(Exception ex)
{
    MessageBox.Show(this, "Connection error: " + ex.Message,
    "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    return;
}

// display message if connection is a success.
MessageBox.Show(this, "Successfully connected to the phone.",
"Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Information);




private void MessageReceived()
{
    Cursor.Current = Cursors.WaitCursor;
    string storage = GetMessageStorage();
    DecodedShortMessage[] messages = CommSetting.comm.ReadMessages
                   (PhoneMessageStatus.ReceivedUnread, storage);
    foreach(DecodedShortMessage message in messages)
    {
         Output(string.Format("Message status = {0},
     Location =  {1}/{2}",
         StatusToString(message.Status),
         message.Storage, message.Index));
         ShowMessage(message.Data);
         Output("");
    }

    Output(string.Format("{0,9} messages read.",
                messages.Length.ToString()));
    Output("");
}   

推荐答案

你好..



按照了解您正在打开手机调制解调器的配件。并尝试沟通。我确实看到comport配置不正确,因为端口0 buadrate 0无效。



我认为您需要获得有关如何使用comport进行硬件通信的一些信息。

Google [ ^ ]



其次,当你直接通过调制解调器(不是电话软件)。你需要使用名为 AT命令的调制解调器命令[ ^ ]



我差不多7年前就已经开始工作了,我不记得发送短信的正确命令,但我在下面举例说明你可以尝试一下。



Hello..

As per understand you are opening a comport of your Phone modem. and trying to communicate. I do see the comport configurations are incorrect because port 0 buadrate 0 is invalid.

I think you need to get some information about the how to communicate hardware with comport.
Google[^]

Second, when you are connect directly through the modem (not phone software). you need to use modem commands called AT commands[^]

I have worked on this almost 7 years back, I did not remember correctly command for sending SMS, But I am giving below example you can try it.

AT+CMGS="919XXXXXXXXXXXX"
<SMS MEssage> 
Crtl+Z







提示:在C#代码使用和终端之前这样做窗口,我使用了超级终端(xp之后不可用,但你可以从网上下载exe)。你可以测试这个命令,一切都OK。然后开始用C#编写代码。



祝你好运

--RA




Tip: before doing this in the C# code use and Terminal window ,I used hyperterminal ( not available after xp, but you can download exe from web). you can test this commands and everything is OK. Then start codeing in C#.

Good Luck
--RA


这篇关于如何使用Android智能手机用数据线发送短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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