How to validate when my app switches with another one

Hello, i am trying to do the next thing:

  1. Go to my application settings
  2. Press Support by a Call button (This button is supposed to switch between my app and the native phone app with a specific phone number)

And the question here is:
How Can i do to know when is in another app? and
How Can i validate the phone number that is displayed on the phone app?
Is it possible?

I ask that here because right now i don’t know where can i start from.

Thanks a lot

Same as with test app. The only difference is that e.g. for android you need write full id with package name.