English 中文(简体)
无法向使用SmsManager的一些电文发送电文
原标题:Unable to send text messages on some Android Phones using SmsManager
  • 时间:2012-01-13 15:09:06
  •  标签:
  • android
  • sms

我的移动电话有时是发送文字信息,但大多数电话都非常有用,但我开始接收一些用户的电子邮件,称这些电文是线索。 这里使用的是:

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("+12223334444", null, "test sms", null, null);

I ve read somewhere that I should use the PendingIntent, so i tried it as follows:

PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent("SMS_SENT"), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent("SMS_DELIVERED"), 0);                     
SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage(number, null, message, sentPI, deliveredPI);   

So far I have gotten emails from users of Samsung Galaxy S II, Sprint Evo Shift, Samsung Sidekick phones.

www.un.org/Depts/DGACM/index_spanish.htm 请铭记这部电话并不具体,即在其中两部电话(我的朋友)上测试了电灯,文本电文通常发送<>。

问题回答

The problem here is that you aren t handling retries at all. It is possible for the SMS to fail to send in a variety of colourful ways. You can listen for these events using the sent PendingIntent using something like:

public void onReceive(Context context, Intent intent) {
    if (getResultCode() != Activity.RESULT_OK) {
        // failed to send the sms, see SmsManager.ERROR_<description> for more info on why
    }
}

我怀疑正在发生的是,用户在发出电文时没有信号,因此它失败,从未尝试过。 这也将解释为什么它带有特定标记。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签