diff --git a/src/org/kde/kdeconnect/Device.java b/src/org/kde/kdeconnect/Device.java index a4c0ca78..73b1b818 100644 --- a/src/org/kde/kdeconnect/Device.java +++ b/src/org/kde/kdeconnect/Device.java @@ -28,6 +28,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.drawable.Drawable; +import android.os.Build; import android.preference.PreferenceManager; import android.support.v4.app.NotificationCompat; import android.support.v4.content.ContextCompat; @@ -693,6 +694,12 @@ public class Device implements BaseLink.PackageReceiver { private synchronized boolean addPlugin(final String pluginKey) { Plugin existing = plugins.get(pluginKey); if (existing != null) { + + if (existing.getMinSdk() > Build.VERSION.SDK_INT) { + Log.i("KDE/addPlugin", "Min API level not fulfilled " + pluginKey); + return false; + } + //Log.w("KDE/addPlugin","plugin already present:" + pluginKey); if (existing.checkOptionalPermissions()) { Log.i("KDE/addPlugin", "Optional Permissions OK " + pluginKey); @@ -712,6 +719,11 @@ public class Device implements BaseLink.PackageReceiver { return false; } + if (plugin.getMinSdk() > Build.VERSION.SDK_INT) { + Log.i("KDE/addPlugin", "Min API level not fulfilled" + pluginKey); + return false; + } + boolean success; try { success = plugin.onCreate(); diff --git a/src/org/kde/kdeconnect/Plugins/Plugin.java b/src/org/kde/kdeconnect/Plugins/Plugin.java index eafdb550..8ad620b0 100644 --- a/src/org/kde/kdeconnect/Plugins/Plugin.java +++ b/src/org/kde/kdeconnect/Plugins/Plugin.java @@ -28,6 +28,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; +import android.os.Build; import android.support.annotation.StringRes; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; @@ -279,4 +280,8 @@ public abstract class Plugin { return arePermissionsGranted(getOptionalPermissions()); } + public int getMinSdk() { + return Build.VERSION_CODES.BASE; + } + }