package com.spoon.backgroundfileupload;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;

import net.gotev.uploadservice.UploadServiceConfig;
import net.gotev.uploadservice.okhttp.OkHttpStack;

public class Application extends com.orm.SugarApp {
    private static final String channelId = "com.spoon.backgroundfileupload.channel";
    private static final String channelName = "upload channel";

    @Override
    public void onCreate() {
        super.onCreate();

        createNotificationChannel();

        UploadServiceConfig.initialize(this, channelId, false);
        UploadServiceConfig.setHttpStack(new OkHttpStack());
    }

    private void createNotificationChannel() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_LOW);
            manager.createNotificationChannel(channel);
        }
    }
}

@@ -583,24 +583,42 @@
 Channel();%0A%0A
+        try %7B%0A    
         Uplo
@@ -669,32 +669,36 @@
 false);%0A        
+    
 UploadServiceCon
@@ -734,16 +734,90 @@
 ack());%0A
+        %7D catch(Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A
     %7D%0A%0A 

add try catch