DownloadManager
doesn't support a completion notification on Gingerbread; you have to display it yourself.
Use a BroadcastReceiver to detect when the download finishes and show your own notification:
public class DownloadBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
//Show a notification
}
}
}
and register it in your manifest:
<receiver android:name="com.zolmo.twentymm.receivers.DownloadBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</receiver>
Also, setNotificationVisibility
was added in API level 11 (Honeycomb) not ICS. I'm not sure if your use of the ICS constant is deliberate or not, but you can change your code to the following to the use the system notification on Honeycomb as well:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
rqtRequest.setShowRunningNotification(true);
} else {
rqtRequest.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}