PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, July 12, 2022

[FIXED] How to use reflection in Android for sending sms from second sim slot?

 July 12, 2022     android, dual-sim, message, reflection, sms     No comments   

Issue

I need to send sms via second slot of an android device. I searched many times to find a solution for sending sms with second sim slot. But there is not any regular solution for this problem. Some people use reflection for each series of mobile devices for sending sms from second slot. Now, how can I use reflection for this problem?


Solution

You don't mention which cookie you're targeting, but in Lollipop MR1 you can send with the second SIM card by fetching the SmsManager based on subscription:

http://developer.android.com/reference/android/telephony/SmsManager.html#getSmsManagerForSubscriptionId(int)

Every SIM card gets assigned a subscription ID when they are inserted. These IDs and information about the SIM are stored in the siminfo table in the TelephonyProvider. The IDs start from 1. To get information about what subscription IDs you currently have active, you use the SubscriptionManager: http://developer.android.com/reference/android/telephony/SubscriptionManager.html

The method getActiveSubscriptionInfoForSimSlotIndex takes a SIM slot index (normally either 0 or 1) and returns subscription info about that SIM, including the subscription ID which you can use to fetch the right SmsManager.

If you're targeting platforms prior to Lollipop then the DS support is not officially supported by Google and it's most likely added by the platform vendor (Qualcomm, Mediatek etc.) so the API is undocumented. You can query the SmsManager for its methods by calling SmsManager.class.getDeclaredMethods(), but the DS API might be in a completely different and undocumented class.



Answered By - fejd
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing