Ad Policy - Google Play

In one app locker app I saw an ad after unlock, with more details: it is an app that locks other app (in this case whatsapp), and when you open whatsapp it shows a screen and asks for password. After you write the password it shows the ad. Is it legal?

As this screen came from background service, is it counted as “out of app ad”, or because of the “unlocker screen” as “inside of app” ?