public class DownloadNotification extends Object implements IDownloaderClient
| Modifier and Type | Class and Description |
|---|---|
static interface |
DownloadNotification.ICustomNotification |
STATE_COMPLETED, STATE_CONNECTING, STATE_DOWNLOADING, STATE_FAILED, STATE_FAILED_CANCELED, STATE_FAILED_FETCHING_URL, STATE_FAILED_SDCARD_FULL, STATE_FAILED_UNLICENSED, STATE_FETCHING_URL, STATE_IDLE, STATE_PAUSED_BY_REQUEST, STATE_PAUSED_NEED_CELLULAR_PERMISSION, STATE_PAUSED_NEED_WIFI, STATE_PAUSED_NETWORK_SETUP_FAILURE, STATE_PAUSED_NETWORK_UNAVAILABLE, STATE_PAUSED_ROAMING, STATE_PAUSED_SDCARD_UNAVAILABLE, STATE_PAUSED_WIFI_DISABLED, STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION| Modifier and Type | Method and Description |
|---|---|
android.app.PendingIntent |
getClientIntent() |
void |
onDownloadProgress(DownloadProgressInfo progress)
Shows the download progress.
|
void |
onDownloadStateChanged(int newState)
Called when the download state changes.
|
void |
onServiceConnected(android.os.Messenger m)
Called internally by the stub when the service is bound to the client.
|
void |
resendState() |
void |
setClientIntent(android.app.PendingIntent mClientIntent) |
void |
setMessenger(android.os.Messenger msg)
Called in response to onClientUpdated.
|
public android.app.PendingIntent getClientIntent()
public void setClientIntent(android.app.PendingIntent mClientIntent)
public void resendState()
public void onDownloadStateChanged(int newState)
IDownloaderClient
The Downloader Library includes a collection of string resources that
correspond to each of the states, which you can use to provide users a
useful message based on the state provided in this callback. To fetch the
appropriate string for a state, call
Helpers.getDownloaderStringResourceIDFromState(int).
What this means to the developer: The application has gotten a message that the download has paused due to lack of WiFi. The developer should then show UI asking the user if they want to enable downloading over cellular connections with appropriate warnings. If the application suddenly starts downloading, the application should revert to showing the progress again, rather than leaving up the download over cellular UI up.
onDownloadStateChanged in interface IDownloaderClientnewState - one of the STATE_* values defined in IDownloaderClientpublic void onDownloadProgress(DownloadProgressInfo progress)
IDownloaderClientonDownloadProgress in interface IDownloaderClientprogress - the DownloadProgressInfo object containing the current
progress of all downloads.public void setMessenger(android.os.Messenger msg)
msg - the client Messenger to notifypublic void onServiceConnected(android.os.Messenger m)
IDownloaderClientCritical implementation detail. In onServiceConnected we create the remote service and marshaler. This is how we pass the client information back to the service so the client can be properly notified of changes. We must do this every time we reconnect to the service.
That is, when you receive this callback, you should call
DownloaderServiceMarshaller.CreateProxy(android.os.Messenger) to instantiate a member
instance of IDownloaderService, then call
IDownloaderService.onClientUpdated(android.os.Messenger) with the Messenger retrieved
from your IStub proxy object.
onServiceConnected in interface IDownloaderClientm - the service Messenger. This Messenger is used to call the
service API from the client.Copyright © 2012–2014 simpligility technologies inc.. All rights reserved.