如何在android的后台运行应用程序? [英] how to run application in background in android?

查看:29
本文介绍了如何在android的后台运行应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个 Android 应用程序,它可以继续在后台运行,当用户访问任何文件夹、图片或任何其他文件时,它会使用 toast 通知他访问了这个文件(文件名).

Hi, I want to make an Android application that continues to run in background and when user accesses any folder, picture, or any other file it notifies using toasts that he accesses this file(filename).

推荐答案

回答你问题的其他人都专注于背景"部分,而 Service 确实可以做到这一点.用户相当大声地表示,他们鄙视像您提议的那样持续运行的服务.

The other people answering your question are focused on the "background" part, and a Service would indeed accomplish this. Users have fairly loudly stated that they despise constantly-running services like the one you are proposing.

当用户访问任何文件夹或图片或任何文件时,它会使用 tosts 通知他访问此文件(文件名).

when user access any folder or picture or any file it notify using tosts that he acess this file(filename).

对于您可以自己访问的文件(例如,外部存储上的文件),您可以使用 FileObserver 类.

For files that you can access yourself (e.g., those on external storage), you can use FileObserver class.

这篇关于如何在android的后台运行应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆