How to use wifi for a specific app and celluar data for the rest? I have a wifi rear view camera in my car. That camera creates a WIFI hotspot for my phone to connect with. If I put my car in reverse the app gets notified and switches to the app to show the camera view. But if i'm connected to the hotspot my phones internet doesn't work (duh) because the camera doesn't have any internet access. 

I only want wifi for that specific app and my phone should use my 4g data, but I don't know how or if it is even possible. 

My phone has android 9 and is rooted. Is this even possible? Because I read that on IOS this works by setting a custom dns (or something)...
You can try to automate the process. The following is accomplished using Automate. There are other apps you can use to get the same results.


Create a new flow.
On the Apps category (on the drawer), select App in foreground?. Set Proceed section to When changed. On the package section, select your app. Save it. Connect it to Flow beginning block.
On the Connectivity category, select Wi-Fi set state. Save it. Set it to On'. Connect itsOKto theYes` of Step 2.
On the Connectivity category, select Wi-Fi set state. Save it. Set it to `Off'.
On the Connectivity category, select Mobile data set state. Save it. Set it to On'. Connect it to theOKof step 4 and to theIn` of Step 2.
Save the flow by pressing the back button. Give it the necessary privileges. Click on Start.


Your flow will look like the image below. When you app is in the foreground, Wi-Fi will be enabled. When your app is the background, Wi-Fi will be disabled and mobile data enabled.

Disclaimer: I am just a user of the app.