Ionic 3/4如何停止从最近的应用程序刷卡时杀死应用程序?

编程入门 行业动态 更新时间:2024-10-14 00:30:12
本文介绍了Ionic 3/4如何停止从最近的应用程序刷卡时杀死应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个基于ionic4/cordova构建应用程序的项目,该应用程序始终在后台运行.它基本上是每小时在后台或前台将数据发送到服务器.

I have a project to build an app based on ionic4/ cordova, running in the background all the time. It basically sends data to server every hour when in the background or foreground.

但是,当应用程序用户在最近的应用程序中向右滑动时,该应用程序将被杀死.我进行了很多搜索,并要求各种人员和文档提供帮助,但到目前为止还没有任何线索.

But the app gets killed when the app user swipes it right in the recent apps. I have searched a lot and asked help from various people and documentations, but haven't got any clue till now.

我是Ionic的新手,请提出一些帮助,如何解决此问题?

I am new to Ionic, please suggest some help, how to deal with this problem?

  • 提前感谢:)
推荐答案

我想您是在要求它进行android构建,因此一些android制造商会在我们向上或向右滑动(按移动功能)时杀死该应用程序延长电池寿命,因此有三种方法可以在后台运行您的应用程序

I suppose you are asking it for android build ,so some of the android manufacturer are killed the app while we swipe up or right (as per mobile feature) to improve battery life,so there is three way to run your app in background

1)一种明显的离子方式是使用自动启动本机插件,该插件已在自动启动,您可以在appponent.ts文件中使用它,因此此插件会在一段时间内自动唤醒您的应用

1)one is obviously ionic way is to use autostart native plugin which has been explain it briefly to ionic documents of autostart you can use it in appponent.ts file so this plugin is automatically wake up your app on some time period

2)第二步是手动操作,只需转到转到设置" >>电池" >>电池优化"并启用自动启动(适用于oneplus android),所有制造商都有自己的设置来启用和禁用自动启动权限,因此将其搜索为根据您的模型.

2)second is to do manual way just go to your Goto Settings >> Battery >> Battery Optimization and enable autolaud (for oneplus android) all the manufacturer has there own setting to enable and disable auto start permission so search it as per your model.

3)在清单文件中,将Service的标志stopWithTask保持为 false .根据此android权限

3)Inside your Manifest file, keep flag stopWithTask as false for Service.As per this android permission link

manifest.xml

manifest.xml

<service android:name="com.myapp.MyService" android:stopWithTask="false" />

谢谢

更多推荐

Ionic 3/4如何停止从最近的应用程序刷卡时杀死应用程序?

本文发布于:2023-11-27 10:47:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637756.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   Ionic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!