From bcb6c95bd6f11a61863ed9796739876adf1bb93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Nicolas?= Date: Sun, 17 Apr 2016 09:56:05 -0700 Subject: [PATCH] target api proper handling in application module --- .../toothpick/smoothie/module/ApplicationModule.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/smoothie/src/main/java/toothpick/smoothie/module/ApplicationModule.java b/smoothie/src/main/java/toothpick/smoothie/module/ApplicationModule.java index 0d6c414f..ed31f9be 100644 --- a/smoothie/src/main/java/toothpick/smoothie/module/ApplicationModule.java +++ b/smoothie/src/main/java/toothpick/smoothie/module/ApplicationModule.java @@ -1,6 +1,7 @@ package toothpick.smoothie.module; import android.accounts.AccountManager; +import android.annotation.TargetApi; import android.app.ActivityManager; import android.app.AlarmManager; import android.app.Application; @@ -89,9 +90,13 @@ private void bindSystemServices(Application application) { bindSystemService(application, TelephonyManager.class, TELEPHONY_SERVICE); bindSystemService(application, AudioManager.class, AUDIO_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { - bindSystemService(application, DownloadManager.class, DOWNLOAD_SERVICE); + bindForGingerBreadAndAbove(application); } - bind(Application.class).to(application); + } + + @TargetApi(Build.VERSION_CODES.GINGERBREAD) + private void bindForGingerBreadAndAbove(Application application) { + bindSystemService(application, DownloadManager.class, DOWNLOAD_SERVICE); } private void bindSystemService(Application application, Class serviceClass, String serviceName) {