In my web app, when submitting a form with a file to be uploaded, if the user pushes the button to turn the screen off before the upload finishes, it doesn't get uploaded. I'm assuming this is because the browser has been put into the background to sleep. I've searched for the answer here for how to approach this problem, but haven't found anything for a web app. Is there a way to keep the browser awake in the background until the file upload finishes, or a way to detect when the browser sleeps and then wakes up, or should I just show the user a message to Please Wait and hope they don't shut the screen off?
I didn't receive any responses. What I ended up doing is just showing a "Uploading..." message with a spinning loader. I'll update my post if I find a better way to handle this.
Related
How to continue download task even when after the device is locked (pressing the power button).
I tried installing an app from the play store, and during its download i locked the device, but it still continues to download without any interruption and is visible on the lockscreen as shown in the screen shot below.
How do we achieve this programmatically?
If you want a task to continue running, even when your Activity is not active, you need to use a Service. https://developer.android.com/guide/components/services.html. The Play Store is probably using a Service to keep the download running in the background, and a Notification to show the status on the lock screen. https://developer.android.com/guide/topics/ui/notifiers/notifications.html
The example screenshot is misleading, since this is the Google Play Store.
Otherwise, one has to initiate the tranfers by DownloadManager.
I've been having reports from users saying that they can no longer open our app; and I have now seen this on my own phone.
When I tap the app icon the screen goes black (showing the title but that's it), then quickly the black screen disappears and you're back in the OS.
Logcat shows zero issues when this happens.
Anyone know what could be happening? This issue has only become apparent within the last few weeks before that there were no reports from users on this particular issue.
EDIT: I've tried restarting the phone, force-stopping the app and clearing the cache+data to no avail.
If your app having use internet or http request over network then write code in method onResume otherwise for http request use asynchronous task
I checkde this link for show mjpeg on my android device.
I tested two links. One is sample link in example code. Other is my cam (APM-H804-WS) link.
The problem happened only on using my cam link.
First executing works well. Turn off the screen, or press home button will make example app disactive. The problem happens here.
Other screen which I see cam's stops. If nothing doing and wait, it disconnected. If I kill example app by like task killer, screen re-starts to move. Even if resume app, it works same. The only way that problem doesn't happen is quickly reload app and wish it connects well. (with log 2. Request finished, status = 200)
No problem when use sample link. Also no problem when use 'IP Camera viewer lite'.
I don`t know where I should fix it...
Suppose I want to start an app to run in background as soon as an event occurs in the phone.
For example:-
When I open my gallery I may want to automatically start my app which monitors my file browsing and prepares database for most recent documents, most listened song, etc and is automatically closed when I exit my gallery folder.
Whenever I open my internet browser I might want to start my app in background, which monitors how many times I visited a particular site and it automatically closes when I close the browser.
I don't think this is possible, and i'm not talking about remote launch app, but capture events of other apps like Gallery or Browser.
If this are only hipotetic examples, you should show a real examples because i think collect this type of data will be more painful problem than trigger app on an event due a lot of security reasons.
I currently have a program where a user fills information out and sends it to a server. It then downloads a one to two MB file to device. I have it setup so the phone does not sleep when it is downloading the file, but it is interrupted when the user manually presses the sleep button or a text comes in to the phone. What would be the best solution to this? Should I create a service or is there someway to tell the activity to keep downloading in the onPause method?
won't it be better to download in the background using an android service and posting an android notification when it will be done?