version bump
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / files / services / FileDownloader.java
index a5ee28f..c051fc1 100644 (file)
@@ -124,12 +124,16 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);\r
         mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, mTotalDownloadSize == -1);\r
         mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);\r
+        // dvelasco ; contentIntent MUST be assigned to avoid app crashes in versions previous to Android 4.x ;\r
+        //              BUT an empty Intent is not a very elegant solution; something smart should happen when a user 'clicks' on a download in the notification bar\r
+        mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);\r
         \r
         mNotificationMngr.notify(1, mNotification);\r
 \r
         File sdCard = Environment.getExternalStorageDirectory();\r
         File file = new File(sdCard.getAbsolutePath() + "/owncloud/" + mAccount.name + mFilePath);\r
         try {\r
+            file.getParentFile().mkdirs();\r
             file.createNewFile();\r
         } catch (IOException e) {\r
             e.printStackTrace();\r
@@ -151,6 +155,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         }\r
         mNotificationMngr.cancel(1);\r
         Intent end = new Intent(DOWNLOAD_FINISH_MESSAGE);\r
+        end.putExtra(EXTRA_FILE_PATH, file.getAbsolutePath());\r
         sendBroadcast(end);\r
     }\r
 \r