简体   繁体   English

以编程方式从最近的应用程序中删除应用程序时,将数据发送到服务器

[英]Send data to the server when remove app from recent apps programmatically

I have an application that works with the database. 我有一个与数据库一起使用的应用程序。

When I exit the application when I click the "exit" button, it sends the data to the server. 当我单击“退出”按钮退出应用程序时,它将数据发送到服务器。 There is a bug: when I remove an app from the recent apps, data is not sent to the server. 有一个错误:当我从最近的应用程序中删除一个应用程序时,数据不会发送到服务器。

How can I fix this? 我怎样才能解决这个问题?

I want the data to be sent to the server when the application is removed from the recent apps. 我希望从最近的应用程序中删除该应用程序后,将数据发送到服务器。

You could spawn a Service during onDestroy , which lets you know when the activity is finished, and send the data from there. 您可以在onDestroy期间生成一个Service,它可以让您知道活动何时完成,并从那里发送数据。

https://developer.android.com/guide/components/activities/activity-lifecycle.html https://developer.android.com/guide/components/activities/activity-lifecycle.html

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

相关问题 以编程方式从最近的应用程序中删除应用程序 - Remove app from recent apps programmatically 当我从最近的应用程序中删除应用程序时,为什么没有触发警报? - Why Alarm not fired when I remove app from recent apps? 当按下返回键android时,从最近的应用程序中删除应用程序 - Remove app from recent apps when back key pressed android 从SEND Intent启动后,Android应用在“最新应用”列表中的行为有所不同 - Android app behaves differently in “recent apps” list when launched from SEND Intent 从最新应用程序中删除应用程序后,自定义静态广播接收器不起作用 - custom static broadcastreceiver not working when app is removed from recent apps 从最近的应用程序中删除应用程序时,“前台”服务将被终止 - “foreground” service is killed when App is removed from recent apps Android,从“最近的应用”中删除应用时取消通知 - Android, cancel notification when app is removed from “Recent apps” 从Android中的最新应用中刷出应用后,服务停止 - Service stopped when app is swiped out from recent apps in Android 从“最近的应用程序”中检测应用程序何时刚刚启动或打开 - Detect when app just started or opened from Recent Apps 从最近的应用程序中删除后,请不要杀死应用程序 - Don't kill app when removed from recent apps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM