• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Dual-Sim profiles?

Hi.

I just got my firs dual-sim phone. I use my personat and word sim on it.

What i want is: I would like that i can set profiles, like
'work' -> Mutes my personal sim and work sim is normal (On between weekdays 7:00-17:00)
'normal' -> Mutes my work sim and personal sim is normal (On between weekdays 17:00 - 7:00 and weekends)
Widgets would be nice too, like 2h mute on all sim:s and extra rules 'return to normal mode' or 'holiday mode'.

I have now searched app that can do that for almost week now. None of what i have found supports Dual-Sim.

Please can anyone help me? I cant be only one with this problem.
 
Simpliest thing that i want to do is, Set timer like 8h and that time work sim volume and alerts are 100% and personal about 20-50%.
And after that given time, its like alerts volume in work sim 20% and personal sim 100%, or what it was before timer started.

Frankly I've never seen any dual-SIM phone that has that feature, and nor any ready made apps that could do it either. So that's why I was thinking it could possibly be made up with Xposed or something, and a module built, and the phone would probably have to be rooted as well.

I've seen timers that can turn the phone on or off and set quiet periods for the whole device, but that's it.
 
Last edited:
Upvote 0
I wrote an app that has all the timer functionality, but only for one sim (well, it basically adjusts the ringer, notification, alarm volumes etc.). I'm happy to take a look and see if it can be adapted for dual-sim, I don't know if it's possible though or how straightforward it will be. I have a dual-sim phone myself so I'm interested to see whether it will work (OnePlus 3T).
 
Upvote 0
I had a look at the Android documentation to see how this could be done. There is nothing I can see anywhere where you can instruct the phone to apply different volumes depending on the sim, but I've seen there are other apps that claim to be able to do this. I suspect what they may be doing is listening for when a call arrives, and adjust the ringtone volume "at the last minute" depending on which sim the call arrived on. I'm pretty sure I can see how do to this in my own app, the problem is that in order to do it properly (and without root) the phone needs to be on Android 7.0 (Nougat). I would prefer to do this properly and use Google's provided interface rather than use a nasty hack that may work on some phones but not others, as I see some of these dual-ringtone apps have a lot of negative reviews with people claiming they don't work.

My Oneplus 3T should be getting Nougat by the end of this month, I'm going to wait for the official version as I don't want to wipe my phone to install their beta so I'll post another update when I have more info. I also need to get a second sim to try it out on.

Not sure if the Nougat requirement is a problem for you...if I can find a way to get it working on an older version I'll post an update.
 
  • Like
Reactions: Myrkky
Upvote 0
If you want to try the app out in the meantime (Marshmallow version, only recognises a single SIM) just to get a feel for it, the details are on http://www.apdroid.byethost5.com/chronoprof/chronoprof.html

I've had to update it recently to support the new way apps request permissions (they now have to request "dangerous" permissions at run-time rather than install-time), so there could well be a few bugs, please let me know if you run into any problems. If the permissions sound a bit scary there is an explanation at this page: http://www.apdroid.byethost5.com/chronoprof/chronoprof.html#gettingstarted
 
Upvote 0
Just a quick heads-up...I found a bug in the current version where changing a setting in the "Default" profile may appear not to have been saved if you then edit again immediately afterwards (the change is actually applied, just doesn't appear until the app is restarted). I'll fix in the next release which I hope to release soon, this will also include the following changes:

- Rather than always revert to the "Default" profile when a timed profile expires, it will be possible to revert to the current profile. The reason for this is that I usually set my phone to "Quiet" when at work, but sometimes there will be a short meeting where I need to set it to "Silent" for 30 minutes, but then I want it to go back to "Quiet" again, not "Default".

- Ability to change the notification and alarm sounds, rather than just the volume.

I've done most of these changes already but need to test them on my own phone for a while before releasing.

(still waiting for OnePlus to fully roll out Nougat...it sounds like the first people who got it reported some problems so to be honest I'm happy to wait for them to fix these and get the stable version).
 
Upvote 0
Brief update...I got the Nougat update yesterday and I have been trying out the new feature where an application can register for incoming calls on individual sims. However, it doesn't seem to be working as expected.. regardless of which number I call, both sims report that they have an incoming call. I've checked my code multiple times to see if there is a bug but I can't see anything obvious. It could be I am doing something wrong, or maybe there is a bug in the OnePlus Nougat implementation (quite possible, especially as they only just released it and had to rush out a fix for the first release they made). I've posted the code below in case any other developers can see a problem.

When you get your phone updated to Nougat please let me know, I can upload a test version of the app with this code so we can see if it works on yours.


Java:
private void listenForIncomingPhoneCalls() {

   try {
      TelephonyManager defaultTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
      SubscriptionManager subscriptionManager = (SubscriptionManager) getSystemService(TELEPHONY_SUBSCRIPTION_SERVICE);
      for (SubscriptionInfo subscriptionInfo: subscriptionManager.getActiveSubscriptionInfoList()){
         TelephonyManager telephonyManagerSub = defaultTelephonyManager.createForSubscriptionId(subscriptionInfo.getSubscriptionId());
         ChronoPhoneStateListener chronoPhoneStateListener = new ChronoPhoneStateListener(subscriptionInfo, telephonyManagerSub);
         telephonyManagerSub.listen(chronoPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
         Log.i(TAG, "Listening for calls on subscription " + subscriptionInfo.toString());
      }

   } catch (Exception e) {
      Log.e(TAG, "Error listening for incoming phone calls", e);
   }
}

class ChronoPhoneStateListener extends PhoneStateListener {

   private final SubscriptionInfo subscriptionInfo;
   private final TelephonyManager telephonyManagerSub;

   public ChronoPhoneStateListener(SubscriptionInfo subscriptionInfo, TelephonyManager telephonyManagerSub) {
      super();
      this.subscriptionInfo = subscriptionInfo;
      this.telephonyManagerSub = telephonyManagerSub;
   }

   @Override
   public void onCallStateChanged(int state, String incomingNumber) {
      super.onCallStateChanged(state, incomingNumber);
      switch(state){
         case TelephonyManager.CALL_STATE_RINGING:


            // *** WHEN A CALL ARRIVES, THIS LINE IS LOGGED BY BOTH SIM LISTENERS ***
            Log.i(TAG, "Incoming call on SIM " + subscriptionInfo.getSimSlotIndex() + " from " + incomingNumber + ", call state=" + telephonyManagerSub.getCallState());


            // this is where we would change volume according to which SIM the call arrived on

            break;
         case TelephonyManager.CALL_STATE_OFFHOOK:
            break;
         case TelephonyManager.CALL_STATE_IDLE:
            break;

      }
   };
 
Upvote 0
After a bit more digging I actually got it working now...but I'm a bit annoyed as it requires a "hack" to get around a limitation of the Nougat code. I really wanted to avoid this kind of thing as it could mean the application is broken if Google decide to make a change to their code in future. For anyone interested in the technical details, the PhoneStateListener needs to set the mSubId field to the subscriptionInfo Id, it can be done via reflection as per below:

(Google, if you're listening please make this part of the API next time!!!)

Anyway, if you don't mind putting up with this I'm pretty sure the rest is straightforward, setting the volume "at the last minute" seems to work ok so now it's just a matter of making this a proper feature of the app.

Java:
public ChronoPhoneStateListener(SubscriptionInfo subscriptionInfo, TelephonyManager telephonyManagerSub) {
            super();
            this.subscriptionInfo = subscriptionInfo;
            this.telephonyManagerSub = telephonyManagerSub;

            try {
                Field field = this.getClass().getSuperclass().getDeclaredField("mSubId");
                field.setAccessible(true);
                field.set(this, subscriptionInfo.getSubscriptionId());
            } catch (Exception e) {
                Log.e(TAG, "Error setting subscription ID");
            }
        }


Update: 29th Jan...I've been thinking about this and I'm now less worried than I was at first..the reason is that Google are clearly recognising that many people now have a multi-SIM phone and are updating Android to support this, so I don't think the reflection hack I'm using is going to be blocked in future. I suspect they just overlooked the need for developers to be able to specify a subscription ID when registering a PhoneStateListener, hopefully they will address this in a future update. I've raised a bug report with them: https://code.google.com/p/android/issues/detail?id=233080
 
Last edited:
Upvote 0
I've made most of the changes to the app now, will do a few more tests before uploading it to Play. I had another idea as well, to see if it's possible to change the ringtone depending on the sim as well as the volume - this could be useful to quickly identify which sim a call is arriving on.

I ran a brief test to see if this is possible - and it did seem to work, as long as the code within my app executed immediately I was able to change the ringtone as the call came in. However, I also tried to see what would happen if I put a delay in before the code executed, i.e. what would happen if I tried to change the ringtone while it was already playing? In this case the original ringtone played and changing it during the playback had no effect, I guess this is expected behaviour.

With that in mind, I'm a bit cautious about putting this feature in, as if there was any kind of delay in my code running it would play the wrong tone which would be confusing. However, given that it worked when the app ran normally I'm happy to put this in but just label it an "experimental feature" and make it clear that it needs to be tested before relying on it.
 
Upvote 0
I've uploaded a beta APK file to the web page in case anyone wants to try this new functionality out : http://www.apdroid.byethost5.com/chronoprof/chronoprof.html#installation

This contains the option to change the ringer volume and ringtone for the 2nd SIM card. Please note I am still testing this version and there may be a few issues that require fixing before I publish it to Google Play; if you run into any problems please let me know. One thing I have noticed is that changing the ringtone at the last minute like this occasionally fails if the ringtone is a custom MP3 file, so I recommend only selecting from the list of built-in ringtones if using this feature. I'm not sure why this problem occurs and I'm still investigating.
 
Upvote 0
Beta APK is updated again with the following changes:

1. I found that the original simple options for "Ringer Mode" weren't always working, for example setting mode to "Silent" would vibrate. I'm not very impressed with the way Google have implemented this and have written up my frustrations at http://www.apdroid.byethost5.com/chronoprof/chronoprof.html#ringermode ...anyway I did find a way to set the "Vibrate for calls" setting which is completely independent from the ringer mode. The new version switches this on when ringer mode is Vibrate and off for the other 2 ringer modes.

2. A profile can now adjust the level of "interruption filters", for example in a "Meeting" profile you may want only important notifications so you could set this to "Priority" (which apps are defined as "priority" needs to be set separately under phone settings). The Default profile resets this back to All (you can change this if you like) so you don't miss anything.

3. When adding/editing a profile, the controls for the second SIM will now only be displayed when the second SIM is active, rather than just present in the phone.

4. It is now possible to configure SMS ringtone for a profile, and each profile can define a sound for SIM 1 and SIM 2 (see http://www.apdroid.byethost5.com/chronoprof/chronoprof.html#sms )

5. Fixed a problem when adding/editing a profile where toggling a control would cause the screen to scroll back to the top.
 
Last edited:
Upvote 0
Welcome :)

I've also uploaded the beta to Google Play so it's easier to install, plus I understand people are probably more comfortable installing an app from Play rather than sideloading an APK, especially as it now needs phone and SMS permissions. The beta link is below:

https://play.google.com/apps/testing/com.aparkin.chronoprof

I'd really appreciate any feedback as there have been so many changes to this recently, so there are likely to be a few issues needing fixing. It's also probably worth having a quick read through this guide at some point which explains how to use it:

http://www.apdroid.byethost5.com/chronoprof/chronoprof.html


** 7th March 2017 update: beta version is now closed, the changes are now all in the standard app on Google Play **
 
Last edited:
Upvote 0
Just thought I'd mention something - I didn't deliberately get a phone with dual-SIM slots as I thought it was not a particularly useful feature and I would probably only use it occasionally when travelling abroad, it just happened that the phone I got supported this. However, since starting the code changes for this app I found a good use for the 2nd SIM, which is when you need to give out a number to some organisation but don't want to get spammed with annoying marketing calls or SMS you can give out this number instead. With the recent app changes I can now set the ring volume and SMS sound for the 2nd SIM to silent so it doesn't interrupt me.

Thanks to the original poster for suggesting this idea as it's going to be more useful than I thought...I've already had 2 annoying marketing calls this week so from now on anyone other than friends or family will get the "junk number".
 
Upvote 0
One thing I have found recently is that if you have a second SIM ringtone set up, this may not work if the app is optimized for aggressive doze & hibernation. This is a battery-saving feature of Android that puts apps into hibernation. If you set up a second SIM ringtone but it doesn't play correctly, try setting ChronoProf to 'not optimized'. These settings can be found under the phone's Battery Settings under 'Aggressive doze & hibernation'
 
Last edited:
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones