diff --git a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java index d3507a848..5fcab1d0b 100644 --- a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java +++ b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java @@ -5,9 +5,6 @@ import android.content.Context; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.support.multidex.MultiDexApplication; -import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.RequiresApi; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.imagepipeline.core.ImagePipelineConfig; @@ -104,22 +101,10 @@ public class CommonsApplication extends MultiDexApplication { Stetho.initializeWithDefaults(this); } - createNotificationChannel(this); // Fire progress callbacks for every 3% of uploaded content System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); } - public static void createNotificationChannel(@NonNull Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - NotificationChannel channel = manager.getNotificationChannel(NOTIFICATION_CHANNEL_ID_ALL); - if (channel == null) { - channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID_ALL, - context.getString(R.string.notifications_channel_name_all), NotificationManager.IMPORTANCE_DEFAULT); - manager.createNotificationChannel(channel); - } - } - } /** * Helps in setting up LeakCanary library diff --git a/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java b/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java index edae8e38d..306c7272f 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java +++ b/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java @@ -122,7 +122,7 @@ public class UploadService extends HandlerService { @Override public void onCreate() { super.onCreate(); - CommonsApplication.createNotificationChannel(getApplicationContext()); + notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } diff --git a/gradle.properties b/gradle.properties index 05aa34949..afb609bda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,8 @@ android.useDeprecatedNdk=true BUTTERKNIFE_VERSION=8.6.0 org.gradle.jvmargs=-Xmx1536M buildToolsVersion=27.0.0 -targetSdkVersion=27 +#TODO: Change back to 27 in v2.9, see https://github.com/commons-app/apps-android-commons/issues/1877 +targetSdkVersion=25 #TODO: Temporary disabled. https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#aapt2 #Refer to PR: https://github.com/commons-app/apps-android-commons/pull/932