Obtain the state of system background download - android

The system connects net using wifi and downloads a file. It will obtain the state of download process. The download process is STATUS_FAILED, STATUS_PAUSED, STATUS_PENDING, STATUS_RUNNING, and STATUS_SUCCESSFUL.
I want to use broadcast mechanism, receive the download radio from system.
And then get the download state with DownloadManager related method. But it is failed. Could you give me some idea? Thanks!

Related

How to manage network in android

I want to downloading image from instagram or picasa, during the downloading the network is disconnected. I want it should be start re downloading when the network connected again. downloading start from where the network was gone.
plz give some idea or any reference link.
Thanks
Register a broadcast for listening to network events. Please check android network events.
This is already solved in many other posts like link

Android how to download something WITHOUT showing any notification or notifying the user

I want to download a file using downloadManager but I don't want to show any notifications. I think the term for this is silent downloading.
Any help would be appreciated.
Method 1:
You can use IntentService for downloading files without any notification.
You can refer this link
Method :2
Also you can use BroadCastReceiver Which is used to capture the Network state changing, Reboot, etc. You can start download from there.
Method 3:
Use AsynkTask for downloading file at the background

Android let app know that media was mounted/unmounted while app was destroyed

Is there a way to let my app know that Media (SDCard) was mounted/unmounted while my app was turned off? I mean that my app and its services were Destroyed, not only stopped.
Probably, some ways to check MediaStore checksum are available?
Goal: decide if new music files were added or deleted in device memory to refresh general playlist.
Why not check if the SDCARD is mounted by using Environment.getExternalStorageState() upon restarting your app? The value you want it to be is Environment.MEDIA_MOUNTED. You could do it async and display a message somewhere stating that an update is in progress, however...
...if it's really the callback-ish thing you need, then you'll have to have a look at what John Willis wrote about registering a BroadcastReceiver.
You have register a broadcast receiver to receive an intent
android.intent.action.MEDIA_MOUNTED

how to run application in background in android?

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).
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.
when user access any folder or picture or any file it notify using tosts that he acess this file(filename).
For files that you can access yourself (e.g., those on external storage), you can use FileObserver class.
Use FileObserver to detect file access or change.

Shared folder implementation

I need to make a shared folder in android.
I want to be able to:
1) create a folder on the device(sdcard/SharedFolder). ;
2) create a folder on the server. ;
3) copy some files to that folder. ;
4) seamlessly synchronize those files with my Android(and vice-versa). ;
The idea is to make an ftp connection to the ftp server(local filzila server at first) and
compare my local files list to his remote files list(by means of comparing timestamps or any other way).
Then my application would decide which files are the most updated and will copy them(from device to server or from the server to the device).
So i have 3 issues which i wanted to talk about:
I.Currently i made my application be a Broadcast-Receiver which is being called by the Alarm-Manager repeatedly(with the inexact method) and run on its own process.
Upon receiving a broadcast i connect to the server and make the above.
currently the broadcast-receiver is set from some Activity(enable/disable buttons and thats it.)
What will happen to my Broadcast-Receiver after killing the Activity which set him? I understood that at some point the system will delete him from the Alarm-Manager too? How should i handle this? I want the program to run without the user handling it... hence after restart of the device and etc i don't want him to re-enable my program.
II. How would you suggest to handle the files compare between the folders? i would like to support copy, delete, edit on those files hence the most suitable version of a file should be on both the server and device after the sync.
i thought about making some manifest file in each folder and save in it data on the file like:
-who change it last and when
-how much readers does this file have(can it be done as a service of the phone? some event of opening a file or a folder?)
and etc.
III.
Any suggestions will be appreciated!
ADB provides a shell interface where you can issue commands shell commands. See http://developer.android.com/guide/developing/tools/adb.html#shellcommands
You can also use the sync command provided with ADB. Open a prompt and issue 'adb help' to see more.

Categories

Resources