Question: New here. I still didn't decide which technology I'll use to make this app, but the main feature is basically this:

There's app A and app B (I don't own any of these);

My app (C) needs only one role: when I login on app A it'll logout on app B and when I login on app B it'll logout on app A.

Note: Forcing app A or B to close will not logout or in.

Anyone knows a way to develop this? The app is supposed to be available on Android and iOS, I was planning to use nativescript.

Any help will be appreciated! Thanks,
Diogo

Answer: 
Unfortunately not because every app run in its specific sand box for security reasons. The only way to do something like that it is using broadcasts intents but the apps A and B should already be prepared to respond to a intent to log out and send a broadcast when log in. Probably it doesn't happen.
Thank you for all your answers. Very useful. Can I use an app to close and open others? For example, If I open Spotify it automatically closes YouTube music using my app. This way would only have to do with the smartphone or tablet.