Dual SIM device : How to configure data usage on per app basis (Rooted device) My Moto X Play (6.0.1, rooted, Xposed installed ) has dual SIM options, which I usually don't use. Recently, I had a need to use two SIMs, borrowed one with generous data allowance and second (personal ) SIM which was halfway to hitting the data cap.

My need was to configure data usage on a per app basis so that :


I don't exhaust data on my personal SIM while being able to use mobile number linked accounts like WhatsApp, Uber, banking accounts etc.
For all other apps , use the data from borrowed SIM


I couldn't find an app  to do this, as is evident from this similar question, which has no responses yet -Is there a way on a DUAL SIM Android phone to configure on a per-app basis, which app uses which sim card to access internet?

How do I configure SIM data usage on per app basis ?

(This is a self answered question to share one way of doing it. You are welcome to post alternate solutions )
Requires Rooted Device, Xposed framework installed,  latest version of GravityBox Xposed module and an automation app - I use Macrodroid

Create a macro in Macrodroid

Trigger: 


Application Launched &rarr; select from the drop down list, all apps you want to use on SIM card linked to banking, WhatsApp, Uber etc (5 apps in example below )
Application Launched &rarr; select from the drop down list, all apps you want to use on second SIM card (16 apps in example below )


( Make sure that apps don't appear on both lists !)

Actions:


If &rarr; +  &rarr; Trigger Fired  &rarr;
Application Launched 5 apps 
&rarr;
Tap End If and add this action - Launch Shortcut  &rarr; GravityBox actions  &rarr; SIM settings  &rarr;  SIM 1 for data 


Repeat this for second set of apps and choose SIM 2 for data

Constraints:   Leave blank

Done !