Dual sim phone to send SMS-pit Daddy dual sim

Source: Internet
Author: User
Tags root access

Recently to write an Android app. One of the features to send text messages, directly copy the Android API Demos sample Os\sms Messaging, on their own mobile phone test. Find always error smsmanager.result_error_no_service, understanding can not.


and started Google.

Found on the Internet very few people mention this error, and the Android text message, all are used API Demos text sample, or use intent call system SMS app to send text messages. Although the use of intent call system SMS app to send text messages can also be regarded as a workround, but the user experience is not good, feel uncomfortable. The texting process in my app should be this: the user clicks the button. Eject the ProgressDialog. The program quietly texting in the background. Shoot, don't. Then tell the user that the message was successful.

Since almost all coder on the Internet use API Demos SMS sample, including several ebook ("Beginning Android application Development-8 Messaging and Networking", " Professional Android 4 application development) All, I think either Google is lying, Android Smsmanager actually has a major bug. Either the way I open ecllipse is incorrect, or I actually live in matrix.

NND. Continue digging deep. So I found the "ADB logcat-b Radio" This method of use, that is, to view the GSM module communication log. Below is the log comparison of the system SMS activity and API demos SMS activity:

Log of System SMS activity
06-10 15:18:26.058 d/sms (28645): encoding detail>textencodingdetails {msgcount=1, codeunitcount=2, CodeUnitsRemai ning=68, codeunitsize=3, languagetable=0, languageshifttable=0}
06-10 15:18:26.178 d/rilj_gsm (418): [3085]> report_sms_memory_status:true
06-10 15:18:26.178 D/rilj (418): [3086]> report_sms_memory_status:true
06-10 15:18:26.188 D/ril_switch (+): Ct_c+w_enable is NULL and set the value to disable.
06-10 15:18:26.188 D/ril_switch (+): RIL SWITCH GO HTC RIL
06-10 15:18:26.188 D/rilj (418): [3086]< report_sms_memory_status
06-10 15:18:26.208 d/rilj_gsm (418): [3085]< report_sms_memory_status
06-10 15:18:26.218 d/rilj_gsm (418): [3087]> report_sms_memory_status:true
06-10 15:18:26.218 D/rilj (418): [3088]> report_sms_memory_status:true
06-10 15:18:26.228 D/ril_switch (+): Ct_c+w_enable is NULL and set the value to disable.
06-10 15:18:26.228 D/ril_switch (+): RIL SWITCH GO HTC RIL
06-10 15:18:26.228 D/rilj (418): [3088]< report_sms_memory_status
06-10 15:18:26.238 d/rilj_gsm (418): [3087]< report_sms_memory_status
06-10 15:18:26.679 d/gsm (418): laugnagetable/shifttable:0/0
06-10 15:18:26.679 d/gsm (418): GEP countgsmseptets:-1
06-10 15:18:26.679 d/sms (418): Sendrawpduwithbundle
06-10 15:18:26.689 d/sms (418): checkinsegmenttoril> [email protected], retrycnt> 0
06-10 15:18:26.689 d/rilj_gsm (418): Sendsms pdu:01000b813145189164f700080454755475
06-10 15:18:26.689 d/rilj_gsm (418): [3089]> send_sms
06-10 15:18:27.410 d/rilj_gsm (418): [3090]> report_sms_memory_status:true
06-10 15:18:27.410 D/rilj (418): [3091]> report_sms_memory_status:true
06-10 15:18:27.410 D/ril_switch (+): Ct_c+w_enable is NULL and set the value to disable.
06-10 15:18:27.410 D/ril_switch (+): RIL SWITCH GO HTC RIL
06-10 15:18:27.410 D/rilj (418): [3091]< report_sms_memory_status
06-10 15:18:29.812 D/rilmux (744): Main (2656) GSM0710 buffer. Stored 0
06-10 15:18:29.812 D/rilmux (744): Main (2657) Frames received/dropped:8632/0
06-10 15:18:31.333 d/rilj_gsm (418): [3089]< send_sms {messageref = 232, ErrorCode =-1, ACKPDU = null}
06-10 15:18:31.333 d/sms (418): Handlemessage > 2
06-10 15:18:31.333 d/sms (418): Pre error Code: 1
06-10 15:18:31.333 d/sms (418): msgref> 232, Trytpmr> 0
06-10 15:18:31.333 d/sms (418): Send complete: [email protected]
06-10 15:18:31.333 d/sms (418): SMS send complete. Broadcasting intent:pendingintent{411ce330: [email protected]}
06-10 15:18:31.333 d/sms (418): Framework sent INTENT:SMS_MO/NUMBER/1402384711344/1
06-10 15:18:31.433 d/rilj_gsm (418): [3090]< report_sms_memory_status
06-10 15:18:31.794 d/rilj_gsm (418): [unsl]< unsol_response_new_sms
06-10 15:18:31.794 d/rilj_gsm (418): Ril_unsol_response_new_sms PDU: 0891683108200805f0040d91683145189164f70008416001518142230454755475
06-10 15:18:31.794 d/gsm (418): SMS SC Address: +8613800280500
06-10 15:18:31.794 d/gsm (418): SMS SC timestamp:1402384704000
06-10 15:18:31.804 V/RILC_IMC (104): Processwakeupcallback
06-10 15:18:31.804 d/sms (418): handlemessage > 1
API Demos SMS Activity log
06-10 14:20:05.949 d/sms (32003): encoding detail>textencodingdetails {msgcount=1, codeunitcount=13, CodeUnitsRema ining=147, codeunitsize=1, languagetable=0, languageshifttable=0}
06-10 14:20:05.959 d/gsm (32003): SMS Status Report requested
06-10 14:20:05.959 d/gsm (32003): laugnagetable/shifttable:0/0
06-10 14:20:05.959 d/gsm (32003): GEP countgsmseptets:13
06-10 14:20:05.969 d/gsm (32003): chartolanguagetable/shifttable: [email protected]/[email protected]
06-10 14:20:05.969 d/gsm (32003): HTC Septets COUNT/SEPTETS:13/13
06-10 14:20:05.969 D/CDMA (418): [Ruimsmsinterfacemanager] sendrawpdu:smsc=null pdu=[[email protected] SentIntentPen dingintent{40f6a430: [email protected]} deliveryintentpendingintent{40f6a450: [email protected]}
06-10 14:20:05.969 d/sms (418): Sendrawpduwithbundle
06-10 14:20:05.969 d/sms (418): handlenotinservice, message send fail ss:1

Please forgive me for cruel, I failed to see from the above log that the API demos SMS activity exactly where the error.

So continue Google, found a lot of interesting things:

    1. Silentsms: The author calls Iccsmsinterfacemanager with reflection to send SMS. Although it looks very cool, the app installation requires root access, so I'm not in a hurry to test this project.
    2. Android Sms/mms/google Voice sending Library: The author override a lot of Android telephony related classes, or the beta version number. Do you feel like you don't need a big lib to send a message?
    3. text+: A free Android App that uses WiFi to send text messages. There are a lot of similar products. In fact, this kind of product has been separated from the simple text messaging function, the entire social-type application. Similar applications in China are also very many, such as, QQ and so on. Just text+, etc. or support sending the message to SMS on a phone that does not have text+ installed.

Complaining so much, in fact is tangled in Why online can use Smsmanager this simple API to send text messages, and my side is not?!

Why exactly?!.

So continue depressed to test, delete the system text drafts in the draft box, see the Menu "Settings-SMS (SMS)", so the hands of a cheap place to go:

Send Report
Request a report for each message you send
Service Center (card slot one)
+8613800xxxxxx
Service Center (Card slot II)
Manage UIM Card information
Manage the information stored in CDMA UIM cards
Manage SIM Card information
Manage the information stored in GSM SIM cards

Send a report, um, this tick is not hit, is expected to receive delivery feedback ... Card slot a slot two, hmm, I am a dual sim phone. There are two card slots ... wait, you have a. I got a go. No, it is because I this dual-sim phone is not plugged into the telecom card and telecom card is the main card Smsmanager the TMD directly connected to the main card and then error?!

Smsmanager. Can you brief a little bit more?

Immediately find a colleague's single-card phone ran the next API Demos, SMS sent successfully ...

Also found a colleague's cell phone, dual sim. The secondary card slot is empty. The main slot is telecommunications, plug in a telecommunications card. Run API Demos, SMS sent successfully ...

The Beast in my heart is galloping.

Google for three days. Read a bunch of data. It turns out this is the reason ...


Ok. Now the problem is clear, the process behind is to find how in the dual sim and just plug in a card or Heze inserted two cards, three cards on the phone with smsmanager hair, short, letter.

To find a lap. Discover or use reflection to discover Smsmanager's hidden APIs. Wrote a reflect tool:

At the same time dump the return value of all methods of Android Telephonymanager. Find some useful information:

Tm.getcallstate () =call_state_idle tm.getdataactivity () =data_activity_none tm.getdatastate () =DATA_DISCONNECTED Tm.getdevicesoftwareversion () =00 tm.getneighboringcellinfo () =[] Tm.getnetworkcountryiso () =CN Tm.getnetworkoperator () =46000 tm.getnetworkoperatorname () = China Mobile Tm.getnetworktype () =network_type_gprs Tm.getphonetype () =phone_type_gsm tm.getsimcountryiso () =cn tm.getsimoperator () =46000 tm.getSimOperatorName () =CMCC Tm.getsimstate () =sim_state_ready tm.getvoicemailalphatag () = voice mail tm.getvoicemailnumber () =null Tm.hasIccCard () =true Tm.isnetworkroaming () =false

Refer to the "Android dual sim to send SMS", with reflect out of the Smsmanager send method or sent failed.

Temporarily do not study, at least now on the single card machine is able to send text messages, dual sim standby with Walkround bar:

    1. Send SMS using the Smsmanager method exposed by Android
    2. Suppose the previous step failed. Send a text message using the reflect Smsmanager method.
    3. If you fail, start your local SMS app with intent and send a text message

To be Continued

Dual sim phone to send SMS-pit Daddy dual sim

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.