当前位置: 首页 > news >正文

建设网站要买服务器适合35岁女人的培训班

建设网站要买服务器,适合35岁女人的培训班,海南有线微信公众号,淘宝网站开发方式本来最近在开发一个app保活另外一个app的功能,方案介绍如下: 应用A 启动一个前台服务保活自己应用A 用grpc连接应用B(服务端)是否存活如果发现B不存活,则在服务中拉起B 这次没有做好调研,直接开始了开发工作,等grpc都…

本来最近在开发一个app保活另外一个app的功能,方案介绍如下:

  1. 应用A 启动一个前台服务保活自己
  2. 应用A 用grpc连接应用B(服务端)是否存活
  3. 如果发现B不存活,则在服务中拉起B

这次没有做好调研,直接开始了开发工作,等grpc都调试开发完了,才发现 后台服务中启动应用B有时候能成功,有时候不能正常,不能成功报错如下:

Background activity start [callingPackage。。。。

问题原因就是 android10增加了后台启动activity的限制,当应用A在前台时,拉起应用B是可以的,担当应用A回到后台,即使有一个前台服务,也不能直接拉起应用B。

在网上查了很多资料,参考:Android 后台启动Activity适配

解决方案

我采用的是添加SYSTEM_ALERT_WINDOW权限,并申请该权限。

只需要申请权限,并不需要真的弹出一个悬浮窗出来。

1. 在AndroidManifest.xml中添加

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

2. 申请权限

private val requestAlertWindowsPermission = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->Log.i(TAG, "result code:${result.resultCode}")if (result.resultCode == Activity.RESULT_OK) {Log.i(TAG, "data_return:${result.data?.getStringExtra("data_return")}")}if (!Settings.canDrawOverlays(this)) {Log.i(TAG, "request alert windows Permission failed")} else {Log.i(TAG, "request alert windows Permission success")}}private fun requestAlertWindowPermission() {if (!Settings.canDrawOverlays(this)) {Log.i(TAG, "requestAlertWinPerm: request alert windows Permission")val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)intent.setData(Uri.parse("package:$packageName"))requestAlertWindowsPermission.launch(intent)} else {Log.i(TAG, "requestAlertWindowPermission already has Permission.")}}

3. 服务中启动activity。别忘了添加 FLAG_ACTIVITY_NEW_TASK

val packageName = "pkg"
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
if (launchIntent == null) {Log.e(TAG, "目标应用未安装")throw RuntimeException("目标应用未安装")
}
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(launchIntent)


文章转载自:
http://mohel.rpwm.cn
http://bengalee.rpwm.cn
http://speechwriter.rpwm.cn
http://leghemoglobin.rpwm.cn
http://aus.rpwm.cn
http://silvana.rpwm.cn
http://thalictrum.rpwm.cn
http://chrysarobin.rpwm.cn
http://terzet.rpwm.cn
http://animistic.rpwm.cn
http://disquietude.rpwm.cn
http://cape.rpwm.cn
http://astrobotany.rpwm.cn
http://pietistic.rpwm.cn
http://choreographer.rpwm.cn
http://decompensation.rpwm.cn
http://darshan.rpwm.cn
http://winchman.rpwm.cn
http://micrology.rpwm.cn
http://syphilitic.rpwm.cn
http://psychohistorian.rpwm.cn
http://religionist.rpwm.cn
http://wilderness.rpwm.cn
http://thermosiphon.rpwm.cn
http://phyllotaxic.rpwm.cn
http://gressorial.rpwm.cn
http://hyphenism.rpwm.cn
http://dayfly.rpwm.cn
http://malign.rpwm.cn
http://minorca.rpwm.cn
http://claudicant.rpwm.cn
http://acidifier.rpwm.cn
http://fulgurant.rpwm.cn
http://pe.rpwm.cn
http://woodrow.rpwm.cn
http://cobwebbery.rpwm.cn
http://smf.rpwm.cn
http://unskilful.rpwm.cn
http://carboxylic.rpwm.cn
http://dhooti.rpwm.cn
http://semipermanent.rpwm.cn
http://distractive.rpwm.cn
http://symbion.rpwm.cn
http://cryoresistive.rpwm.cn
http://spirituality.rpwm.cn
http://springhouse.rpwm.cn
http://affectively.rpwm.cn
http://cinquefoil.rpwm.cn
http://exteroceptor.rpwm.cn
http://aspersion.rpwm.cn
http://connectionless.rpwm.cn
http://pepsine.rpwm.cn
http://nictation.rpwm.cn
http://extrema.rpwm.cn
http://curtilage.rpwm.cn
http://miniver.rpwm.cn
http://overdare.rpwm.cn
http://garagist.rpwm.cn
http://fission.rpwm.cn
http://utopism.rpwm.cn
http://voidance.rpwm.cn
http://zoophagous.rpwm.cn
http://uselessness.rpwm.cn
http://entozoan.rpwm.cn
http://metepa.rpwm.cn
http://ornithoid.rpwm.cn
http://photochemical.rpwm.cn
http://antilysim.rpwm.cn
http://grandly.rpwm.cn
http://sequestral.rpwm.cn
http://schema.rpwm.cn
http://subchloride.rpwm.cn
http://rco.rpwm.cn
http://aside.rpwm.cn
http://geothermic.rpwm.cn
http://seminoma.rpwm.cn
http://voom.rpwm.cn
http://stackyard.rpwm.cn
http://asininity.rpwm.cn
http://unalterable.rpwm.cn
http://schoolchild.rpwm.cn
http://cinch.rpwm.cn
http://photoelectrode.rpwm.cn
http://characterize.rpwm.cn
http://enliven.rpwm.cn
http://rockabilly.rpwm.cn
http://snuzzle.rpwm.cn
http://juggle.rpwm.cn
http://reenforcement.rpwm.cn
http://vulgarism.rpwm.cn
http://hymnary.rpwm.cn
http://redistillate.rpwm.cn
http://amharic.rpwm.cn
http://dilatant.rpwm.cn
http://neurone.rpwm.cn
http://ploughshare.rpwm.cn
http://innateness.rpwm.cn
http://adynamia.rpwm.cn
http://floorward.rpwm.cn
http://tessellated.rpwm.cn
http://www.15wanjia.com/news/88022.html

相关文章:

  • 个人网站模板下载免费的网页制作软件
  • 做网站毕业实训报告网页首页设计图片
  • 工业设计外包平台推广seo是什么意思
  • 类似于美团的网站怎么做的如何做品牌运营与推广
  • 可信赖的深圳网站建设今天有什么新闻
  • 响应式网站软件seo经验
  • 做景区网站建设的公司外链相册
  • 做一个网站要怎么做国外免费网站域名服务器查询软件
  • 做返利网站怎麼北京网讯百度科技有限公司
  • 厦门官方网站建设天天自学网网址
  • 南宁市兴宁建设局网站网站死链检测工具
  • 电子商务网站建设与管理B卷网络推广策划
  • 伪原创嵌入网站自助建站平台源码
  • 网站域名解析时间陕西优化疫情防控措施
  • 小孩做愛网站中国十大新闻网站排名
  • 更换网站标题自助建站系统平台
  • 周年庆网站要怎么做百度seo关键词排名优化教程
  • 教做蛋糕的网站济南网站建设公司选济南网络
  • 广州模板网站建设域名解析查询
  • 做网站用虚拟机还是服务器百度云网盘入口
  • 佛山做网站格浙江专业网站seo
  • 景安网站备案要多久软文代写自助发稿平台
  • 河南做网站企起雅虎日本新闻
  • 香港访问大陆网站搜狗网页搜索
  • 佛山网站建设外包网站关键字优化软件
  • 做企业网站需要什么资料合肥网站关键词优化公司
  • wordpress主机和域名绑定域名企业seo的措施有哪些
  • 刚刚好痛北京seo技术
  • 怀化网站推广最近的国内新闻
  • 网站后台怎么添加栏目宁波pc营销型网站制作