当前位置: 动力学知识库 > 问答 > 编程问答 >

Android development for sms related error

问题描述:

When I am sending SMS using android code then it return RESULT_ERROR_GENERIC_FAILURE on same device(Samsung s7562)

String phoneNumber = "889999999";

String message = "MBL A2Z" ;

SmsManager sms=SmsManager.getDefault();

PendingIntent piSent=PendingIntent.getBroadcast(Mobile_recharge.this, 0, new Intent("SMS_SENT"), 0);

PendingIntent piDelivered=PendingIntent.getBroadcast(Mobile_recharge.this, 0, new

Intent("SMS_DELIVERED"), 0);

sms.sendTextMessage(phoneNumber, null, message, piSent, piDelivered);

Running above code on samsung s7562 it gives me RESULT_ERROR_GENERIC_FAILURE error.

网友答案:

link about error

check if you did these all :

import android.telephony.SmsManager;

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);

set this permission to manifest:

<uses-permission android:name="android.permission.SEND_SMS" />
分享给朋友:
您可能感兴趣的文章:
随机阅读: