diff --git a/build.gradle b/build.gradle
index 3e17477..6b87ca1 100755
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,12 @@
+repositories {
+ jcenter()
+ maven { url "https://oss.sonatype.org/content/groups/public/" }
+}
+
buildscript {
repositories {
jcenter()
+ maven { url "https://oss.sonatype.org/content/groups/public/" }
}
dependencies {
@@ -8,11 +14,6 @@ buildscript {
}
}
-repositories {
- jcenter()
- maven { url "https://oss.sonatype.org/content/groups/public/" }
-}
-
apply plugin: 'com.android.library'
android {
diff --git a/lint.xml b/lint.xml
index b4037be..0cad0cd 100644
--- a/lint.xml
+++ b/lint.xml
@@ -1,5 +1,6 @@
+
diff --git a/src/edu/northwestern/cbits/anthracite/Logger.java b/src/edu/northwestern/cbits/anthracite/Logger.java
index c3f1f19..f96869b 100755
--- a/src/edu/northwestern/cbits/anthracite/Logger.java
+++ b/src/edu/northwestern/cbits/anthracite/Logger.java
@@ -20,6 +20,7 @@
import android.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
+import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ContentValues;
@@ -162,7 +163,7 @@ public static Logger getInstance(Context context, String userId)
return Logger._sharedInstance;
}
- @SuppressWarnings("unchecked")
+ @SuppressLint({"BadHostnameVerifier", "TrustAllX509TrustManager", "MissingPermission"})
public boolean log(String event, Map payload)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this._context);
@@ -202,7 +203,7 @@ public boolean log(String event, Map payload)
{
if (prefs.getBoolean(Logger.LOGGER_LOCATION_ENABLED, Logger.LOGGER_LOCATION_ENABLED_DEFAULT))
{
- if (ContextCompat.checkSelfPermission(this._context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this._context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (ContextCompat.checkSelfPermission(this._context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this._context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED))
{
LocationManager lm = (LocationManager) this._context.getSystemService(Context.LOCATION_SERVICE);
@@ -804,7 +805,7 @@ public static String getSystemUserId(Context context)
{
String userId = null;
- if (ContextCompat.checkSelfPermission(context, "android.permissions.GET_ACCOUNTS") == PackageManager.PERMISSION_GRANTED) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (ContextCompat.checkSelfPermission(context, "android.permissions.GET_ACCOUNTS") == PackageManager.PERMISSION_GRANTED)) {
AccountManager manager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
Account[] list = manager.getAccountsByType("com.google");
diff --git a/src/edu/northwestern/cbits/anthracite/PowerHelper.java b/src/edu/northwestern/cbits/anthracite/PowerHelper.java
index 9fc839a..dc612da 100755
--- a/src/edu/northwestern/cbits/anthracite/PowerHelper.java
+++ b/src/edu/northwestern/cbits/anthracite/PowerHelper.java
@@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
+import android.os.Build;
public class PowerHelper
{
@@ -12,6 +13,11 @@ public static boolean isPluggedIn(Context context)
Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
- return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;
+ }
+
+ return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB;
}
}