ECn Categories > Non-Existent Result Notification (NRN) > Non-existent Notification of Queued Process (NNQP)
There was an unexpected background process which produced a result, and it was not informed to the user.
Amount of Issues | App List |
---|---|
6 | (A4) Galaxy Zoo, (A14) Wikimedia Commons, (A19) K-9 Mail, (A44) Materialistic - Hacker News |
Examples
Galaxy Zoo
The following code snippets show the classes and files that are involved in the generation of the previuos issue.
In order to see how this error is generated, we need to review all the flow event. First, as it can be seen in the video the user select to download an image and that menu item triggers the “doDownloadImage” method.
app/src/main/java/com/murrayc/galaxyzoo/app/SubjectFragment.java
private void doDownloadImage() {
Inside that method happens 3 important events, the first one is at line 196 where the download notification is created. The second one is at line 204 where the first approach to create a new “DownloadManager” is made, following the documentation that states “Instances of this class must be obtained using Context.getSystemService(Class) with the argument DownloadManager.class or Context.getSystemService(String) with the argument Context.DOWNLOAD_SERVICE” as it can be seen at line 204
app/src/main/java/com/murrayc/galaxyzoo/app/SubjectFragment.java
final DownloadManager.Request request = new DownloadManager.Request(uri);
196. request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
final Activity activity = getActivity();
if (activity == null) {
Log.error("doDownloadImage(): activity was null.");
return;
}
204. final Object systemService = activity.getSystemService(Context.DOWNLOAD_SERVICE);
if (systemService == null || !(systemService instanceof DownloadManager)) {
Log.error("doDownloadImage(): Could not get DOWNLOAD_SERVICE.");
return;
}
Finally at line 210 the “DownloadManager” object is parsed and at line 211 the new request is queued in order to be resolve. Nevertheless, from the documentation we can now that the “DownloadManager” will perform several attemps to resolve the request. So at this point we know that there is a missing notification to the user to let him know that the request that he made without connectivity are still in queue in order to let it know that only need to ask for the content once
app/src/main/java/com/murrayc/galaxyzoo/app/SubjectFragment.java
final DownloadManager downloadManager = (DownloadManager)systemService;
211. downloadManager.enqueue(request);