Compare commits

...

6 Commits

7 changed files with 48 additions and 10 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 96 versionCode 98
versionName "1.6.21" versionName "1.6.22"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -42,7 +42,7 @@ android {
dimension "version" dimension "version"
// applicationIdSuffix ".googlePlay" // applicationIdSuffix ".googlePlay"
versionNameSuffix "-googlePlay" versionNameSuffix "-googlePlay"
targetSdkVersion 29 targetSdkVersion 30
} }
fdroidFlavor fdroidFlavor

View File

@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.jens.automation2",
"variantName": "processGooglePlayFlavorReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 98,
"versionName": "1.6.22-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk"
}
]
}

View File

@ -33,6 +33,7 @@ public class ActivityPermissions extends Activity
public static final int requestCodeForPermissions = 12042; public static final int requestCodeForPermissions = 12042;
private static final int requestCodeForPermissionsWriteSettings = 12043; private static final int requestCodeForPermissionsWriteSettings = 12043;
private static final int requestCodeForPermissionsNotificationPolicy = 12044; private static final int requestCodeForPermissionsNotificationPolicy = 12044;
private static final int requestCodeForPermissionsBackgroundLocation = 12045;
protected String[] specificPermissionsToRequest = null; protected String[] specificPermissionsToRequest = null;
public static String intentExtraName = "permissionsToBeRequested"; public static String intentExtraName = "permissionsToBeRequested";
@ -768,6 +769,16 @@ public class ActivityPermissions extends Activity
} }
} }
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
if (requestCode == requestCodeForPermissionsBackgroundLocation)
{
NotificationManager mNotificationManager = (NotificationManager) ActivityPermissions.this.getSystemService(Context.NOTIFICATION_SERVICE);
if (mNotificationManager.isNotificationPolicyAccessGranted())
requestPermissions(cachedPermissionsToRequest, true);
}
}
} }
} }
@ -827,6 +838,15 @@ public class ActivityPermissions extends Activity
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy); startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
return; return;
} }
// else if (s.equalsIgnoreCase(permissionNameLocationBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
// {
// requiredPermissions.remove(s);
// cachedPermissionsToRequest = requiredPermissions;
// Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
// intent.setData(Uri.parse("package:" + getPackageName()));
// startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation);
// return;
// }
} }
} }

View File

@ -10,10 +10,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.File; import java.io.File;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -72,7 +70,7 @@ public class News
String filePath = context.getFilesDir() + "/appNews.xml"; String filePath = context.getFilesDir() + "/appNews.xml";
if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == -1 || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.pollNewsEveryXDays * 24 * 60 * 60 * 1000)) if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == -1 || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.newsDisplayForXDays * 24 * 60 * 60 * 1000))
{ {
String newsUrl = "https://server47.de/automation/appNews.php"; String newsUrl = "https://server47.de/automation/appNews.php";
newsContent = Miscellaneous.downloadURL(newsUrl, null, null); newsContent = Miscellaneous.downloadURL(newsUrl, null, null);
@ -245,7 +243,7 @@ public class News
try try
{ {
Calendar limit = Calendar.getInstance(); Calendar limit = Calendar.getInstance();
limit.add(Calendar.DAY_OF_MONTH, -Settings.pollNewsEveryXDays); limit.add(Calendar.DAY_OF_MONTH, -Settings.newsPollEveryXDays);
return downloadNews(contexts[0], limit); return downloadNews(contexts[0], limit);
} }
catch(Exception e) catch(Exception e)

View File

@ -56,7 +56,7 @@ public class ReceiverCoordinator
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
e.printStackTrace(); // e.printStackTrace();
allImplementers = new Class[] { allImplementers = new Class[] {
AlarmListener.class, AlarmListener.class,

View File

@ -12,7 +12,8 @@ public class Settings implements SharedPreferences
{ {
public static final int rulesThatHaveBeenRanHistorySize = 10; public static final int rulesThatHaveBeenRanHistorySize = 10;
public final static int lockSoundChangesInterval = 15; public final static int lockSoundChangesInterval = 15;
public static final int pollNewsEveryXDays = 7; public static final int newsPollEveryXDays = 3;
public static final int newsDisplayForXDays = 3;
public static final String folderName = "Automation"; public static final String folderName = "Automation";
public static long minimumDistanceChangeForGpsUpdate; public static long minimumDistanceChangeForGpsUpdate;

View File

@ -594,7 +594,8 @@
<string name="startScreen">Start screen</string> <string name="startScreen">Start screen</string>
<string name="startScreenSummary">Select the screen the applications opens withs at start.</string> <string name="startScreenSummary">Select the screen the applications opens withs at start.</string>
<string name="executeRulesAndProfilesWithSingleClickTitle">Run rules/profiles with single click.</string> <string name="executeRulesAndProfilesWithSingleClickTitle">Run rules/profiles with single click.</string>
<string name="googleLocationChicanery">This app collects location data to determine if you\'re currently at one of the locations you created. Furthermore it is used to determine your current speed if you are using that trigger in rules. That is done even when the app is closed or not in use (but only when the service is activated).</string> <string name="googleLocationChicanery">This app collects location data to enable location based rules and speed detection even when the app is closed or not in use.</string>
<string name="googleLocationChicaneryOld">This app collects location data to determine if you\'re currently at one of the locations you created. Furthermore it is used to determine your current speed if you are using that trigger in rules. That is done even when the app is closed or not in use (but only when the service is activated).</string>
<string name="android.permission.ACCESS_BACKGROUND_LOCATION">Read location in background.</string> <string name="android.permission.ACCESS_BACKGROUND_LOCATION">Read location in background.</string>
<string name="deviceDoesNotHaveBluetooth">This device does not seem to have bluetooth. You can still continue configuring this, but it will most likely not have an effect.</string> <string name="deviceDoesNotHaveBluetooth">This device does not seem to have bluetooth. You can still continue configuring this, but it will most likely not have an effect.</string>
<string name="manageLocations">Create or edit locations</string> <string name="manageLocations">Create or edit locations</string>