简体   繁体   English

即使应用程序不在前台,也会弹出一个 imageView

[英]Pop-up an imageView even if app is not in foreground

我想知道是否可以显示 imageView 即使应用程序不在前台或被杀死,就像在应用程序关闭的情况下在一段时间后显示广告一样如果是,我们该怎么做。

It is possible to run code even if your app is not in the foreground through using services like JobScheduler or WorkManager in Android.通过使用 Android 中的JobSchedulerWorkManager等服务,即使您的应用程序不在前台,也可以运行代码。

This is how apps such as Alarm Apps can ring at a later time even if the app isn't opened.这就是闹钟应用程序等应用程序可以在以后响铃的方式,即使该应用程序未打开。

However, keep in mind that it is DEFINITELY NOT OKAY for you to run ads OUTSIDE of your foreground App.但是,请记住,这是绝对不行的,你运行你的应用前景的广告之外 To schedule for ads to appear when you're app isn't running is easily considered as behavior for malware and it's an easy ticket to getting your app killed off and potentially your Developer account closed for all eternity.在您的应用程序未运行时安排广告显示很容易被视为恶意软件的行为,它很容易让您的应用程序被杀死并可能永远关闭您的开发者帐户。

But if you want to show an Image at a later time even if your app isn't running, for legitimate purposes , then you can do so through scheduling jobs through the services I mentioned in my first line.但是,如果出于合法目的,即使您的应用程序没有运行,您也想稍后显示图像,那么您可以通过我在第一行中提到的服务安排作业来实现。

I repeat.我重复。

It is NOT OKAY to show ads after your app is placed in the background or after it is destroyed.在您的应用程序置于后台或销毁后显示广告是不合适的。

It is NOT OKAY to show ads at a later time if your app is not the foreground app.如果您的应用程序不是前台应用程序,则稍后再显示广告是不行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM