Сравнить коммиты

..
11 Коммитов
Автор SHA1 Сообщение Дата
Anton Tananaev e8a1e015d4 Enable multidex 2020-09-28 21:21:16 -07:00
Anton Tananaev ceb15c1378 Update version number 2020-09-28 21:07:42 -07:00
Anton Tananaev d25c745013 Update crashlytics 2020-09-28 21:07:17 -07:00
Anton Tananaev c24df5b246 Update notification priority 2020-09-20 11:16:41 -07:00
Anton Tananaev 283d0467b4 Add option to disable wakelock 2020-09-20 11:08:10 -07:00
Anton Tananaev 83bf1daa84 Use different method 2020-09-20 11:01:03 -07:00
Anton Tananaev 96d61c4c66 Update libraries 2020-09-20 10:50:21 -07:00
Anton Tananaev 3978a3d8d6 Update path 2020-09-06 15:05:41 -07:00
Anton Tananaev 78018c3038 Update templates 2020-07-05 11:05:41 -07:00
Anton Tananaev 19b7c4da21 Minor project file update 2020-06-19 22:28:02 -07:00
Anton Tananaev a3d43294ce Update project and tests 2020-06-10 21:14:19 -07:00
17 изменённых файлов: 115 добавлений и 31 удалений
+1
Просмотреть файл
@@ -0,0 +1 @@
custom: https://www.traccar.org/donate/
-7
Просмотреть файл
@@ -1,7 +0,0 @@
<!--
Do you want to ask a question? Traccar official forum is the best place for getting support:
https://www.traccar.org/forums/
-->
+38
Просмотреть файл
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+20
Просмотреть файл
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+21 -9
Просмотреть файл
@@ -8,8 +8,18 @@ android {
buildConfigField 'boolean', 'HIDDEN_APP', 'false' buildConfigField 'boolean', 'HIDDEN_APP', 'false'
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionCode 63 versionCode 65
versionName '6.2' versionName '6.4'
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
} }
lintOptions { lintOptions {
@@ -19,7 +29,7 @@ android {
flavorDimensions 'default' flavorDimensions 'default'
productFlavors { productFlavors {
regular { regular {
isDefault.set(true) isDefault = true
} }
google google
hidden { hidden {
@@ -36,21 +46,23 @@ android {
} }
dependencies { dependencies {
implementation 'com.google.android.material:material:1.2.0-alpha06' implementation 'com.google.android.material:material:1.3.0-alpha02'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'
testImplementation 'junit:junit:4.13' testImplementation 'junit:junit:4.13'
testImplementation 'org.robolectric:robolectric:4.1' testImplementation 'org.robolectric:robolectric:4.1'
googleImplementation 'com.google.firebase:firebase-core:17.3.0' googleImplementation 'com.google.firebase:firebase-core:17.5.0'
googleImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' googleImplementation 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
googleImplementation 'com.google.android.gms:play-services-location:17.0.0' googleImplementation 'com.google.firebase:firebase-analytics:17.5.0'
googleImplementation 'com.google.android.gms:play-services-location:17.1.0'
} }
if (getGradle().getStartParameter().getTaskRequests().toString().contains('Google')) { if (getGradle().getStartParameter().getTaskRequests().toString().contains('Google')) {
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric' apply plugin: 'com.google.firebase.crashlytics'
task copyJson(type: Copy) { task copyJson(type: Copy) {
from '../../traccar-shared/google-services' from '../../environment/google-services'
into '.' into '.'
include 'traccar-client-android.json' include 'traccar-client-android.json'
rename('traccar-client-android.json', 'google-services.json') rename('traccar-client-android.json', 'google-services.json')
+5 -4
Просмотреть файл
@@ -1,5 +1,5 @@
/* /*
* Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.traccar.client; package org.traccar.client;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Application;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
@@ -27,7 +26,9 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
public class MainApplication extends Application { import androidx.multidex.MultiDexApplication;
public class MainApplication extends MultiDexApplication {
public static final String PRIMARY_CHANNEL = "default"; public static final String PRIMARY_CHANNEL = "default";
@@ -46,7 +47,7 @@ public class MainApplication extends Application {
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
private void registerChannel() { private void registerChannel() {
NotificationChannel channel = new NotificationChannel( NotificationChannel channel = new NotificationChannel(
PRIMARY_CHANNEL, getString(R.string.channel_default), NotificationManager.IMPORTANCE_MIN); PRIMARY_CHANNEL, getString(R.string.channel_default), NotificationManager.IMPORTANCE_LOW);
channel.setLightColor(Color.GREEN); channel.setLightColor(Color.GREEN);
channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel); ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel);
+3 -1
Просмотреть файл
@@ -66,6 +66,7 @@ public class MainFragment extends PreferenceFragmentCompat implements OnSharedPr
public static final String KEY_ACCURACY = "accuracy"; public static final String KEY_ACCURACY = "accuracy";
public static final String KEY_STATUS = "status"; public static final String KEY_STATUS = "status";
public static final String KEY_BUFFER = "buffer"; public static final String KEY_BUFFER = "buffer";
public static final String KEY_WAKELOCK = "wakelock";
private static final int PERMISSIONS_REQUEST_LOCATION = 2; private static final int PERMISSIONS_REQUEST_LOCATION = 2;
@@ -83,7 +84,7 @@ public class MainFragment extends PreferenceFragmentCompat implements OnSharedPr
setHasOptionsMenu(true); setHasOptionsMenu(true);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
addPreferencesFromResource(R.xml.preferences); setPreferencesFromResource(R.xml.preferences, rootKey);
initPreferences(); initPreferences();
findPreference(KEY_DEVICE).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { findPreference(KEY_DEVICE).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@@ -206,6 +207,7 @@ public class MainFragment extends PreferenceFragmentCompat implements OnSharedPr
findPreference(KEY_ANGLE).setEnabled(enabled); findPreference(KEY_ANGLE).setEnabled(enabled);
findPreference(KEY_ACCURACY).setEnabled(enabled); findPreference(KEY_ACCURACY).setEnabled(enabled);
findPreference(KEY_BUFFER).setEnabled(enabled); findPreference(KEY_BUFFER).setEnabled(enabled);
findPreference(KEY_WAKELOCK).setEnabled(enabled);
} }
@Override @Override
-1
Просмотреть файл
@@ -25,7 +25,6 @@ public class TrackingController implements PositionProvider.PositionListener, Ne
private static final String TAG = TrackingController.class.getSimpleName(); private static final String TAG = TrackingController.class.getSimpleName();
private static final int RETRY_DELAY = 30 * 1000; private static final int RETRY_DELAY = 30 * 1000;
private static final int WAKE_LOCK_TIMEOUT = 120 * 1000;
private boolean isOnline; private boolean isOnline;
private boolean isWaiting; private boolean isWaiting;
+6 -3
Просмотреть файл
@@ -29,6 +29,7 @@ import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.os.PowerManager; import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
public class TrackingService extends Service { public class TrackingService extends Service {
@@ -87,9 +88,11 @@ public class TrackingService extends Service {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(MainFragment.KEY_WAKELOCK, true)) {
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getClass().getName()); PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock.acquire(); wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getClass().getName());
wakeLock.acquire();
}
trackingController = new TrackingController(this); trackingController = new TrackingController(this);
trackingController.start(); trackingController.start();
+3
Просмотреть файл
@@ -23,6 +23,9 @@
<string name="settings_buffer">Offline buffering</string> <string name="settings_buffer">Offline buffering</string>
<string name="settings_buffer_off_summary">Buffering off</string> <string name="settings_buffer_off_summary">Buffering off</string>
<string name="settings_buffer_on_summary">Buffering on</string> <string name="settings_buffer_on_summary">Buffering on</string>
<string name="settings_wakelock">Wake lock</string>
<string name="settings_wakelock_off_summary">Wake lock off</string>
<string name="settings_wakelock_on_summary">Wake lock on</string>
<string name="settings_accuracy_title">Location accuracy</string> <string name="settings_accuracy_title">Location accuracy</string>
<string name="settings_accuracy_summary">Desired location accuracy</string> <string name="settings_accuracy_summary">Desired location accuracy</string>
<string name="settings_accuracy_high">High</string> <string name="settings_accuracy_high">High</string>
+7
Просмотреть файл
@@ -56,4 +56,11 @@
android:summaryOn="@string/settings_buffer_on_summary" android:summaryOn="@string/settings_buffer_on_summary"
android:title="@string/settings_buffer" /> android:title="@string/settings_buffer" />
<CheckBoxPreference
android:defaultValue="true"
android:key="wakelock"
android:summaryOff="@string/settings_wakelock_off_summary"
android:summaryOn="@string/settings_wakelock_on_summary"
android:title="@string/settings_wakelock" />
</PreferenceScreen> </PreferenceScreen>
+2
Просмотреть файл
@@ -2,6 +2,7 @@
package org.traccar.client; package org.traccar.client;
import android.location.Location; import android.location.Location;
import android.os.Build;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -14,6 +15,7 @@ import java.util.Date;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@Config(sdk = Build.VERSION_CODES.P)
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class DatabaseHelperTest { public class DatabaseHelperTest {
+2
Просмотреть файл
@@ -2,6 +2,7 @@
package org.traccar.client; package org.traccar.client;
import android.location.Location; import android.location.Location;
import android.os.Build;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -12,6 +13,7 @@ import java.util.Date;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@Config(sdk = Build.VERSION_CODES.P)
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class ProtocolFormatterTest { public class ProtocolFormatterTest {
+4 -1
Просмотреть файл
@@ -1,6 +1,8 @@
package org.traccar.client; package org.traccar.client;
import android.os.Build;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -9,10 +11,11 @@ import org.robolectric.annotation.Config;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@Config(sdk = Build.VERSION_CODES.P)
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class RequestManagerTest { public class RequestManagerTest {
@Ignore @Ignore("Not a real unit test")
@Test @Test
public void testSendRequest() throws Exception { public void testSendRequest() throws Exception {
+2 -3
Просмотреть файл
@@ -2,12 +2,11 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
maven { url 'https://maven.fabric.io/public' }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.28.0' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
} }
} }
-1
Просмотреть файл
@@ -1,3 +1,2 @@
android.enableJetifier=true android.enableJetifier=true
android.useAndroidX=true android.useAndroidX=true
android.enableUnitTestBinaryResources=true
+1 -1
Просмотреть файл
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip