简体   繁体   中英

How to detect File downloaded in android

Is their a way to detect file is downloaded, any broadcast receiver, file observer, content observer or any other method & get its path. I have google it but didn't find any luck. Looking forward for your experience advice.

Note : I can detect new files from camera using File Observer, so I know how to use above mention methods.

Edit: File downloaded from any app, lets say hotmail or dropbox, observe it from background service..

I would suggest you to make file downloading code in The asynctask and Observer.

onPostExecute method of asyctask Update the flag variable to be download status and then use it in the main thread from where it is called in Update Method of Observer.

new Observer() {

        @Override
        public void update(Observable observable, Object data) {
           // From here you can parse your response and take appropriate action.

        }
    };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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