2012-03-29 212 views
2

我嘗試使用下一個代碼發送短信,但收件人收到我的消息兩次。我檢查本地應用程序,如果我使用它發送短信,收件人只會收到一條消息。測試應用。代碼在這裏:使用sendTextMessage方法發送短信兩次

package com.test2; 

import android.app.Activity; 
import android.app.PendingIntent; 
import android.content.ContentResolver; 
import android.content.ContentValues; 
import android.content.Context; 
import android.content.Intent; 
import android.net.Uri; 
import android.os.Bundle; 
import android.telephony.SmsManager; 

public class Test1Activity extends Activity { 

    private static final String ACTION_SMS_SENT = "com.testapp.ACTION_SMS_SENT"; 


    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     sendSms("Alice","+375295959617"); 
    } 

    private void sendSms(String msg, String address) { 
     Intent sentIntent = new Intent(ACTION_SMS_SENT); 

     SmsManager smsManager = SmsManager.getDefault(); 

     PendingIntent sentPendingIntent = PendingIntent 
      .getBroadcast(this, 0, sentIntent, 
       PendingIntent.FLAG_CANCEL_CURRENT); 
     smsManager.sendTextMessage(address, null, msg, sentPendingIntent, null); 
    } 

    public static Uri addMessage(Context c, String address, String body, Long date, boolean deliveryReport, long threadId) { 

     /** 
     * The content:// style URL for this table 
     */ 

     final Uri CONTENT_URI = Uri.parse("content://sms/outbox"); 

     return addMessageToUri(c.getContentResolver(), CONTENT_URI, address, body, null, date, true, deliveryReport, threadId); 
    } 

    public static Uri addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date, boolean read, boolean deliveryReport, long threadId) { 

     ContentValues values = new ContentValues(7); 

     values.put(ADDRESS, address); 
     if (date != null) { 
      values.put(DATE, date); 
     } 
     values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); 
     values.put(SUBJECT, subject); 
     values.put(BODY, body); 
     if (deliveryReport) { 
      values.put(STATUS, STATUS_PENDING); 
     } 
     if (threadId != -1L) { 
      values.put(THREAD_ID, threadId); 
     } 
     Uri newUri = resolver.insert(uri, values); 


     return newUri; 
    } 

    /** 
    * The thread ID of the message 
    * <P> 
    * Type: INTEGER 
    * </P> 
    */ 
    public static final String THREAD_ID = "thread_id"; 

    /** 
    * The address of the other party 
    * <P> 
    * Type: TEXT 
    * </P> 
    */ 
    public static final String ADDRESS = "address"; 

    /** 
    * The person ID of the sender 
    * <P> 
    * Type: INTEGER (long) 
    * </P> 
    */ 
// public static final String PERSON_ID = "person"; 

    /** 
    * The date the message was sent 
    * <P> 
    * Type: INTEGER (long) 
    * </P> 
    */ 
    public static final String DATE = "date"; 

    /** 
    * Has the message been read 
    * <P> 
    * Type: INTEGER (boolean) 
    * </P> 
    */ 
    public static final String READ = "read"; 

// public static final String ERROR_CODE = "err_code"; 

    /** 
    * The TP-Status value for the message, or -1 if no status has been received 
    */ 
    public static final String STATUS = "status"; 
// public static final int STATUS_NONE = -1; 
// public static final int STATUS_COMPLETE = 0; 
    public static final int STATUS_PENDING = 64; 
// public static final int STATUS_FAILED = 128; 

    /** 
    * The subject of the message, if present 
    * <P> 
    * Type: TEXT 
    * </P> 
    */ 
    public static final String SUBJECT = "subject"; 

    /** 
    * The body of the message 
    * <P> 
    * Type: TEXT 
    * </P> 
    */ 
    public static final String BODY = "body"; 

    public static final String TYPE = "type"; 

// public static final int MESSAGE_TYPE_ALL = 0; 
    public static final int MESSAGE_TYPE_INBOX = 1; 
    public static final int MESSAGE_TYPE_SENT = 2; 
    public static final int MESSAGE_TYPE_DRAFT = 3; 
    public static final int MESSAGE_TYPE_OUTBOX = 4; 
    public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing 
    // messages 
    public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send 
} 

電話:銀河S2 ICS,銀河S2 GB
此錯誤僅發生在S2 ICS
亞行logcat -b廣播:

D/RILJ (2257): [12827]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12827]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12828]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12828]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=-1ms arg1=19932 
obj=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19933 delay=360s 
D/RILJ (2257): [12829]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12829]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12830]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12830]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12831]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12831]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
W/RIL  (1824): process_multiclient(): EOS. multi client socket(27), errno:11 

I/RILS (19978): SecPhone :: onStart() 
I/RILS (19978): Connected to '7777' socket 
D/RILJ (2257): [12832]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12832]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12833]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12833]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=0 arg1=19933 ob 
j=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19934 delay=360s 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=0 arg1=19934 ob 
j=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19935 delay=360s 
D/RILJ (2257): [12834]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12834]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12835]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12835]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12836]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12836]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12837]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12837]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12838]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12838]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270368 when=0 arg1=1 } 
D/RILJ (2257): [12839]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12839]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12840]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12840]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=0 arg1=19935 ob 
j=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19936 delay=360s 
D/RILJ (2257): [12841]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12841]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12842]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12842]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12843]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12843]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12844]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12844]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILClient(1825): [*] RecordReqHistory(): token(1), ID(59) 
D/RILClient(1825): [*] RecordReqHistory(): token(1), ID(59) 
D/RILClient(1825): SendOemRequestHookRaw(): token = 1 
D/RILClient(1825): processRxBuffer: status 0 response_type 0 
D/RILClient(1825): processSolicited() 
D/RILClient(1825): [*] FindReqHandler(): token(1) 
D/RILClient(1825): processSolicited: No handler for token 1 
D/RILClient(1825): [*] ClearReqHistory(): token(1) 
D/RILClient(1825): processRxBuffer: status 0 response_type 1 
D/RILClient(1825): processUnsolicited(): resp_id (11011), len(2) 
D/RILClient(1825): [*] RxReaderFunc() b_connect=1 
D/RILJ (2257): [12845]> SCREEN_STATE: true 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12845]< SCREEN_STATE 
D/GSM  (2257): [GsmDCT] onReceive: action=android.intent.action.SCREEN_ON 
D/GSM  (2257): [GsmDCT] stopNetStatPoll 
D/GSM  (2257): [GsmDCT] overall state is IDLE 
D/RILJ (2257): [12846]> OPERATOR 
D/RILJ (2257): [12847]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12848]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12849]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12846]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12847]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12848]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12849]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [12850]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12850]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12851]> SCREEN_STATE: false 
D/RILJ (2257): [12851]< SCREEN_STATE 
D/GSM  (2257): [GsmDCT] onReceive: action=android.intent.action.SCREEN_OFF 
D/GSM  (2257): [GsmDCT] stopNetStatPoll 
D/GSM  (2257): [GsmDCT] overall state is IDLE 
E/RIL  (1824): +handle_modemctl_event 
D/RILJ (2257): [12852]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12852]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=0 arg1=19936 ob 
j=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19937 delay=360s 
D/RILJ (2257): [12853]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12853]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
E/RIL  (1824): +handle_modemctl_event 
E/RIL  (1824): +handle_modemctl_event 
D/RILJ (2257): [12854]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12854]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
E/RIL  (1824): +handle_modemctl_event 
D/RILJ (2257): [12855]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12855]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12856]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12856]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12857]> SCREEN_STATE: true 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12857]< SCREEN_STATE 
D/GSM  (2257): [GsmDCT] onReceive: action=android.intent.action.SCREEN_ON 
D/GSM  (2257): [GsmDCT] stopNetStatPoll 
D/GSM  (2257): [GsmDCT] overall state is IDLE 
D/RILJ (2257): [12858]> OPERATOR 
D/RILJ (2257): [12859]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12860]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12861]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12858]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12859]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12860]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12861]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [12862]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12862]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
E/RIL  (1824): +handle_modemctl_event 
E/RIL  (1824): +handle_modemctl_event 
D/RILJ (2257): [12863]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12863]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
E/RIL  (1824): +handle_modemctl_event 
D/GSM  (2257): [GsmDCT] onReceive: action=com.android.internal.telephony.gpr 
s-data-stall 
D/GSM  (2257): [GsmDCT] handleMessage msg={ what=270353 when=0 arg1=19937 ob 
j=com.android.internal.telephony.gprs-data-stall } 
D/GSM  (2257): [GsmDCT] startDataStallAlarm: tag=19938 delay=360s 
D/RILJ (2257): [12864]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12864]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/RILJ (2257): [12865]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12865]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 
D/SMS  (2257): isSMSBlocked=false 
D/SMS  (2257): isSMSBlocked=false 
D/RILJ (2257): [12866]> SEND_SMS 
D/SMS  (2257): isSMSBlocked=false 
D/SMS  (2257): isSMSBlocked=false 
D/RILJ (2257): [12867]> SEND_SMS 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12868]> OPERATOR 
D/RILJ (2257): [12869]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12870]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12868]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12871]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12869]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12870]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12871]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [12866]< SEND_SMS { messageRef = 10, errorCode = 0, ackPdu = 
null} 
D/RILJ (2257): [UNSL]< UNSOL_STK_SEND_SMS_RESULT {0} 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12872]> OPERATOR 
D/RILJ (2257): [12873]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12874]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12872]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12873]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12875]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12874]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12875]< QUERY_NETWORK_SELECTION_MODE {0} 
D/RILJ (2257): [12876]> OPERATOR 
D/RILJ (2257): [12877]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12876]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12878]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12879]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12877]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12878]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12879]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12880]> OPERATOR 
D/RILJ (2257): [12881]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12882]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12880]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12883]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12881]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12882]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12883]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [12867]< SEND_SMS { messageRef = 11, errorCode = 0, ackPdu = 
null} 
D/RILJ (2257): [UNSL]< UNSOL_STK_SEND_SMS_RESULT {0} 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [UNSL]< UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 
D/RILJ (2257): [12884]> OPERATOR 
D/RILJ (2257): [12885]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12886]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12884]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12887]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12888]> OPERATOR 
D/RILJ (2257): [12889]> DATA_REGISTRATION_STATE 
D/RILJ (2257): [12885]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12886]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12887]< QUERY_NETWORK_SELECTION_MODE {0} 
D/RILJ (2257): [12888]< OPERATOR {MTS BY, MTS BY, 25702} 
D/RILJ (2257): [12890]> VOICE_REGISTRATION_STATE 
D/RILJ (2257): [12889]< DATA_REGISTRATION_STATE {1, 00c8, 00c80521, 9} 
D/RILJ (2257): [12891]> QUERY_NETWORK_SELECTION_MODE 
D/RILJ (2257): [12890]< VOICE_REGISTRATION_STATE {1, 00c8, 00c80521} 
D/RILJ (2257): [12891]< QUERY_NETWORK_SELECTION_MODE {0} 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo, carrier=[25702], im 
si=[257027010122629] 
D/GSM  (2257): [SpnOverride] getMatchingSpnOverrideInfo - no entry for carri 
er=[25702] 
D/GSM  (2257): [GsmSST] Poll ServiceState done: oldSS=[0 home MTS BY MTS BY 
25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false 
] newSS=[0 home MTS BY MTS BY 25702 HSDPA:9 CSS not supported -1 -1 RoamInd=-1 
DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0 oldMaxDataCalls=1 mNewMaxData 
Calls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=HSDPA:9 newType=H 
SDPA:9 
D/RILJ (2257): [12892]> REQUEST_GET_NEIGHBORING_CELL_IDS 
D/RILJ (2257): [12892]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android. 
internal.telephony.CommandException: REQUEST_NOT_SUPPORTED 

我檢查這個解決方案Android 1.6 SMS (older application code)和有同樣的結果

UPD 錯誤報告:http://code.google.com/p/android/issues/detail?id=27024
這是一個固件問題

+0

請發表您的完整代碼。 – Rajkiran 2012-03-29 15:20:30

+0

我改變了問題的主體 – 2012-03-29 15:31:24

+0

嗯。確保你根本不會調用'sendSms()'兩次。另外請確保,沒有其他代碼部分發送短信。 – Rajkiran 2012-03-29 15:33:24

回答

3

看起來有些手機(HTC紋身,三星Galaxy S2,與LPQ固件電話)在sendTextMessage一個錯誤,但它應該很好地工作sendMultipartTextMessage。

Android sendTextMessage sends two identical messages on exceution

+0

最初這個錯誤是sendMultipartTextMessage,但我用這兩種方法做了一個測試日誌 – 2012-04-01 08:54:24