Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milestone v131 — Migrating to WorkManager, OSM prompt option, file upload broadcast, notification for errors, SPD_KPH param #1126

Merged
merged 75 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
35b0139
Understanding workmanager and what data can be passed along
mendhak Mar 14, 2024
47069b9
Giving a work a tag, and that lets it be replaced/unique
mendhak Mar 14, 2024
cda359d
Add network constraints, backoff criteria, initial delay, retry count
mendhak Mar 15, 2024
9c236dd
Convert the Custom Url Job to a Custom Url Worker
mendhak Mar 15, 2024
cbd1656
Sending on wifi vs any connection
mendhak Mar 15, 2024
1213812
OpenGTS sender and logger to use the new WorkManager worker
mendhak Mar 16, 2024
180b366
Custom URL Worker calls back to OpenGTS to build the requests
mendhak Mar 16, 2024
4ac67ac
Ensure battery level is used in OpenGTS build
mendhak Mar 16, 2024
90be811
Move Custom URL CSV upload into the Custom URL worker
mendhak Mar 16, 2024
5596fa8
Remove unsed data input
mendhak Mar 16, 2024
d9c6be0
Remove unused code
mendhak Mar 16, 2024
e5d73c0
Clarify run attempt count in log message
mendhak Mar 16, 2024
385a192
Custom URL should respect the wifi-only setting
mendhak Mar 16, 2024
c826b57
Refactor the workreqeust into a reusable method
mendhak Mar 16, 2024
21abbfb
Pass input data as a hashmap in the standard worker builder
mendhak Mar 16, 2024
d41c1ef
Pass input data as a hashmap in the standard worker builder
mendhak Mar 16, 2024
a14cc03
Remove unused imports
mendhak Mar 16, 2024
b103a63
Custom URL Job no longer required
mendhak Mar 16, 2024
4a7ecb3
UDP implementation for OpenGTS Background Worker
mendhak Mar 16, 2024
62a613d
Remove unused OpenGTS UDP Job class
mendhak Mar 17, 2024
d502377
Dropbox Worker using WorkManager instead of Jobqueue
mendhak Mar 17, 2024
ccc5844
Remove unused Dropbox Job
mendhak Mar 17, 2024
ee10921
Replace Auto email job with Work manager
mendhak Mar 17, 2024
ad7e4c7
Remove unused auto email job
mendhak Mar 17, 2024
47e4dce
Work manager implementation for FTP uploads
mendhak Mar 17, 2024
1058898
Remove unused arguments
mendhak Mar 17, 2024
c61eab9
Remove unused FTP Job
mendhak Mar 17, 2024
65e54dc
Google Drive upload using WorkManager
mendhak Mar 17, 2024
db209eb
Remove unused Google Drive Job
mendhak Mar 17, 2024
a317cee
Openstreetmap WorkManager
mendhak Mar 17, 2024
4ada1b7
Remove unused OpenStreetMap job
mendhak Mar 17, 2024
d1cea06
Move OwnCloud into workmanager
mendhak Mar 17, 2024
821fd0b
Move SFTP upload to WorkManager
mendhak Mar 17, 2024
4e8a83b
Remove unused Owncloud and unused sftp job queue
mendhak Mar 17, 2024
43a9068
Remove references to Priority JobQueue, switched over to WorkManager
mendhak Mar 17, 2024
d3e3e6c
Remove redundant logging line
mendhak Mar 17, 2024
0a8972d
Remove redundant commented code
mendhak Mar 17, 2024
0cc8017
Move entire workmanager and workrequest queueing into one method call
mendhak Mar 17, 2024
758f1e0
Make dropbox worker use filepath just like the other workers
mendhak Mar 17, 2024
38d52a5
Android gradle plugin and version changes
mendhak Mar 19, 2024
48f2c3f
If the auto send interval is set to 0, don't set a timer for it.
mendhak Mar 19, 2024
fe56cee
Run tests without cache and add a github action reporter
mendhak Mar 19, 2024
87ba3f9
removing test reporter, not adding much over what I've already got
mendhak Mar 19, 2024
db8ded3
Clarify that auto send also sends when file name changes, based on ho…
mendhak Mar 23, 2024
66b2757
Unnecessary check - the auto send timer is already being reset to zer…
mendhak Mar 23, 2024
21f197f
Merge from master
mendhak Mar 28, 2024
112194f
Option to enable or disable prompting before starting logging, if OSM…
mendhak Mar 28, 2024
bbd6fe4
Changelog for 1313
mendhak Mar 28, 2024
2410070
131 version bump
mendhak Mar 28, 2024
bc2e9d8
Send a broadcast when a file is uploaded using customurl
mendhak Apr 1, 2024
38568a8
Add description for receiving file uploaded event
mendhak Apr 1, 2024
1c41950
Change to file paths, plural. Broadcast from email sender
mendhak Apr 1, 2024
28b7d85
Clarifying internal and external receivers
mendhak Apr 1, 2024
2d92cd6
Send broadcast fileuploaded for FTP
mendhak Apr 1, 2024
26d5aea
Send broadcast fileuploaded for Google Drive
mendhak Apr 1, 2024
79df7f7
Rename the callback type which is also used as the sender type in bro…
mendhak Apr 1, 2024
310da53
Notify internal listeners before external listeners
mendhak Apr 1, 2024
907d2c4
Changelog for file upload broadcasts
mendhak Apr 1, 2024
1f23846
AppAuth-Android comment
mendhak Apr 1, 2024
a372dd8
Update gradle packages
mendhak Apr 13, 2024
74aca9f
Add SPD_KPH as custom URL logging parameter
flyingOwl May 26, 2024
943a894
Add SPD_KPH to unit tests
flyingOwl May 26, 2024
c62b680
New error notification channel for critical errors such as lack of pe…
mendhak May 26, 2024
da36634
Rearrange SPD and SPD_KPH
mendhak May 26, 2024
95fa61a
Stabilize the app when permissions have been revoked. Moved the start…
mendhak May 26, 2024
972c06e
Remove the big icon because it was only visible in dark mode.
mendhak May 27, 2024
708b60b
Show a notification if file write failure occurs. Continues logging a…
mendhak May 27, 2024
a93d29f
Update links and similar apps
mendhak May 27, 2024
f0d886a
When Custom URL requests fail, show an error channel notification.
mendhak May 27, 2024
22d1ece
Revert "When Custom URL requests fail, show an error channel notifica…
mendhak May 27, 2024
b8a36de
Update changelog
mendhak May 27, 2024
cff23f0
Version update
mendhak May 27, 2024
cd32b48
Set notification to auto close when clicking. Also when recovering fr…
mendhak May 28, 2024
09b3504
Merge pull request #1146 from mendhak/master
mendhak Jun 2, 2024
41ca664
Rearrange releaes notes
mendhak Jun 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
java-version: '17'

- name: Build with Gradle
run: ./gradlew assembleDebugUnitTest -Dpre-dex=false
run: ./gradlew assembleDebugUnitTest -Dpre-dex=false --no-configuration-cache

- name: Run Unit Tests
run: ./gradlew testDebugUnitTest -Dpre-dex=false -q
run: ./gradlew testDebugUnitTest -Dpre-dex=false -q --no-configuration-cache
4 changes: 3 additions & 1 deletion assets/text/faq/faq13-difference-other-apps.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## How is this different from other logging apps?

It's meant to be more battery efficient. A lot of other apps, such as [OpenTracks](https://github.com/OpenTracksApp/OpenTracks), usually go with the assumption that you have a data connection available and your routes won't be very long. They use CPU wakelocks and log points extremely frequently with high accuracy. The aim of GPSLogger is to log points and stay quiet.
It's meant to be more battery efficient. A lot of other apps, such as [OpenTracks](https://github.com/OpenTracksApp/OpenTracks), usually go with the assumption that you have a data connection available and your routes won't be very long.
They use CPU wakelocks and log points extremely frequently with high accuracy. The aim of GPSLogger is to log points and stay quiet.

To put it another way, OpenTracks or similar are better suited for runs; GPSLogger is suited for days out, hiking, photography.

[BasicAirData GPSLogger](https://play.google.com/store/apps/details?id=eu.basicairdata.graziano.gpslogger&hl=en&gl=US), [Ultra GPS Logger](https://play.google.com/store/apps/details?id=com.flashlight.lite.gps.logger&hl=en&gl=US) have similar names but aren't associated with this project.
40 changes: 26 additions & 14 deletions assets/text/faq/faq14-tasker-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,32 @@ The app comes with a Start and a Stop **shortcut** (long press home screen, add

### Listening to GPSLogger

GPSLogger sends a broadcast start/stop of logging, or file uploaded, which you can receive as an event.

In Tasker, this would be the `Intent Received` event.
Set the action to `com.mendhak.gpslogger.EVENT`.
You can then access the extras as `%variablename` or `%arrayname1`.

In Automate, you can use the Broadcast Receive block.
Set the Action to `com.mendhak.gpslogger.EVENT`.
Set the dictionary with broadcast extras to a variable, then access the extras as `myvar["variablename"]` or `myvar["arrayname"][0]`.

From there in your task, you can look at the following variables.

*Start/Stop logging*

* `gpsloggerevent` - `started` or `stopped`
* `filename` - the base filename that was chosen (no extension)
* `startedtimestamp` - timestamp when logging was started (epoch)
* `duration` - seconds since the current session started
* `distance` - meters travelled since the session started


*File uploaded*

* `gpsloggerevent` - `fileuploaded`
* `filepaths` - an array of file paths that were uploaded, even if it's just a single file
* `sendertype` - which sender was used to upload the file, e.g. `customurl`, `ftp`, etc.

(Experimental feature) GPSLogger sends a broadcast start/stop of logging, which you can receive as an event.

In Tasker, this would look like:

> Event: Intent Received
Action: com.mendhak.gpslogger.EVENT

From there in your task, you can look at the following variables

* `%gpsloggerevent` - `started` or `stopped`
* `%filename` - the base filename that was chosen (no extension)
* `%startedtimestamp` - timestamp when logging was started (epoch)
* `%duration` - seconds since the current session started
* `%distance` - meters travelled since the session started

In a custom application, receive the `com.mendhak.gpslogger.EVENT` broadcast and have a look inside the extras.
6 changes: 3 additions & 3 deletions assets/text/faq/faq17-other-uses.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

The GPS files produced by this app are generally used for processing *other* things.

A common use case is to geotag photos. Many cameras, especially SLRs, don't have built-in GPS. After a day (or days) out of photography, you may have hundreds of photos that need to be geotagged so that their locations can appear properly when used elsewhere.
A common use case is to geotag photos. Many cameras, especially SLRs, don't have built-in GPS. After a day (or days) out of photography, you may have hundreds of photos that need to be geotagged so that their locations can appear properly when used elsewhere.

I have had success with:

* [GeoSetter](http://www.geosetter.de/en/) - GUI, comprehensive options with map display
* [ExifTool](http://askubuntu.com/questions/599395/how-can-i-batch-tag-several-hundred-photos-with-separately-recorded-gps-data) - command line, lots of options
* Lightroom's map module - very basic and limited
* [digiKam](https://www.digikam.org/) - Open Source photo management. Geotagging and geocoding are tools within this software
* [ExifTool](http://askubuntu.com/questions/599395/how-can-i-batch-tag-several-hundred-photos-with-separately-recorded-gps-data) - command line, lots of options


There are of course other uses of the produced files, these are a few I've seen over the years; it's usually a combination of a log file produced from GPSLogger with a secondary software to process the files.
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
6 changes: 6 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/131.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* OpenStreetMap option to be prompted before logging starts
* Switching to Android WorkManager for sending tasks, should be more reliable.
* Broadcast is sent when file upload completed, useful for automation to clean up files.
* Error notifications and less crashing if permissions have been revoked or file writes fail.
* New Custom URL parameter, %SPD_KPH
* Clarified autosend description: dynamic file name change also results in the file being sent.
44 changes: 22 additions & 22 deletions gpslogger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:8.1.4'

classpath 'org.jacoco:org.jacoco.core:0.7.4.201502262128'
classpath 'org.jacoco:org.jacoco.core:0.8.7'
classpath "com.moowork.gradle:gradle-node-plugin:0.13"
}
}
Expand Down Expand Up @@ -37,16 +37,18 @@ repositories {
}

android {
compileSdkVersion 30
compileSdkVersion 34

defaultConfig {
applicationId "com.mendhak.gpslogger"
minSdkVersion 16
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 30
compileSdk 34
versionCode 131
versionName "131-rc2"

versionCode 130
versionName "130"

// Used by AppAuth-Android
manifestPlaceholders = [
appAuthRedirectScheme: 'com.mendhak.gpslogger'
]
Expand Down Expand Up @@ -86,8 +88,6 @@ android {
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}


}

buildTypes {
Expand Down Expand Up @@ -121,10 +121,10 @@ android {
dependencies {

// implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.activity:activity:1.3.1"
implementation "androidx.fragment:fragment:1.3.6"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
implementation "androidx.activity:activity:1.8.2"
implementation "androidx.fragment:fragment:1.6.2"
implementation "androidx.preference:preference:1.2.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"


//Google Drive Oauth
Expand All @@ -136,7 +136,7 @@ dependencies {


//Debug Logging
implementation('org.slf4j:slf4j-api:1.7.6')
implementation('org.slf4j:slf4j-api:1.7.30')
implementation('com.github.tony19:logback-android-classic:1.1.1-2'){
exclude group: 'com.google.android', module: 'android'
}
Expand All @@ -145,7 +145,7 @@ dependencies {


//Android lollipop/material features including the Toolbar
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.appcompat:appcompat:1.6.1'


//Cardviews
Expand All @@ -163,10 +163,10 @@ dependencies {
//Progress button
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'

//Android Priority Jobqueue
implementation ('com.birbit:android-priority-jobqueue:2.0.1'){
exclude group: 'com.google.android', module: 'android'
}
//Android's WorkManager
implementation 'androidx.work:work-runtime:2.9.0'
// We need to use Gson to help with WorkManager limitations
implementation 'com.google.code.gson:gson:2.10.1'
mendhak marked this conversation as resolved.
Show resolved Hide resolved

//Event bus
implementation 'de.greenrobot:eventbus:2.4.0'
Expand Down Expand Up @@ -215,8 +215,8 @@ dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.10.0'
testImplementation 'org.json:json:20180813'
testImplementation 'androidx.test:runner:1.4.0'
testImplementation 'androidx.test:rules:1.4.0'
testImplementation 'androidx.test:runner:1.5.2'
testImplementation 'androidx.test:rules:1.5.0'
}


Expand All @@ -233,7 +233,7 @@ tasks.withType(Test) {
}
}

tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
//Don't run lint. Takes too long.
if (task.name.contains("lint")) {
task.enabled = false
Expand Down Expand Up @@ -264,7 +264,7 @@ task buildTranslationArray {
}
preBuild.dependsOn buildTranslationArray

tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
if (task.name == 'preDebugBuild' || task.name == 'preReleaseBuild') {
task.dependsOn buildTranslationArray
}
Expand Down
7 changes: 4 additions & 3 deletions gpslogger/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
package="com.mendhak.gpslogger"
>
android:installLocation="auto">

<!-- Satellite and network location services -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Expand Down Expand Up @@ -31,6 +29,8 @@
<!-- Beginning with Android 14 (API level 34), this is necessary. -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />


<application
android:allowBackup="true"
Expand All @@ -39,6 +39,7 @@
android:theme="@style/AppTheme"
android:name="com.mendhak.gpslogger.common.AppSettings"
android:usesCleartextTraffic="true"
android:enableOnBackInvokedCallback="true"
android:requestLegacyExternalStorage="true"
>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
@SuppressLint("MissingPermission")
public class GpsLoggingService extends Service {
private static NotificationManager notificationManager;
private static int NOTIFICATION_ID = 8675309;
private final IBinder binder = new GpsLoggingBinder();
AlarmManager nextPointAlarmManager;
private NotificationCompat.Builder nfc;
Expand Down Expand Up @@ -89,10 +88,10 @@ public IBinder onBind(Intent arg0) {
public void onCreate() {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
}
else {
startForeground(NOTIFICATION_ID, getNotification());
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification());
}
} catch (Exception ex) {
LOG.error("Could not start GPSLoggingService in foreground. ", ex);
Expand Down Expand Up @@ -126,18 +125,21 @@ public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
}
else {
startForeground(NOTIFICATION_ID, getNotification());
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification());
}
} catch (Exception ex) {
LOG.error("Could not start GPSLoggingService in foreground. ", ex);
}

if(session.isStarted() && gpsLocationListener == null && towerLocationListener == null && passiveLocationListener == null) {
LOG.warn("App might be recovering from an unexpected stop. Starting logging again.");
startLogging();
if(Systems.hasUserGrantedAllNecessaryPermissions(this)){
LOG.warn("App might be recovering from an unexpected stop. Starting logging again.");
startLogging();
}

}

handleIntent(intent);
Expand Down Expand Up @@ -179,8 +181,7 @@ private void handleIntent(Intent intent) {

if(!Systems.locationPermissionsGranted(this)){
LOG.error("User has not granted permission to access location services. Will not continue!");
stopLogging();
stopSelf();
Systems.showErrorNotification(this, getString(R.string.gpslogger_permissions_permanently_denied));
return;
}

Expand Down Expand Up @@ -398,10 +399,10 @@ protected void startLogging() {

try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
}
else {
startForeground(NOTIFICATION_ID, getNotification());
startForeground(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, getNotification());
}
} catch (Exception ex) {
LOG.error("Could not start GPSLoggingService in foreground. ", ex);
Expand All @@ -420,7 +421,7 @@ protected void startLogging() {
}

private void notifyByBroadcast(boolean loggingStarted) {
LOG.debug("Sending a custom broadcast");
LOG.debug("Sending a started/stopped broadcast");
String event = (loggingStarted) ? "started" : "stopped";
Intent sendIntent = new Intent();
sendIntent.setAction("com.mendhak.gpslogger.EVENT");
Expand Down Expand Up @@ -529,21 +530,7 @@ private Notification getNotification() {

if (nfc == null) {

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

NotificationChannel channel = new NotificationChannel("gpslogger", getString(R.string.app_name), NotificationManager.IMPORTANCE_DEFAULT);
channel.enableLights(false);
channel.enableVibration(false);
channel.setSound(null,null);
channel.setLockscreenVisibility(preferenceHelper.shouldHideNotificationFromLockScreen() ? Notification.VISIBILITY_PRIVATE : Notification.VISIBILITY_PUBLIC);

channel.setShowBadge(true);
manager.createNotificationChannel(channel);

}

nfc = new NotificationCompat.Builder(getApplicationContext(),"gpslogger")
nfc = new NotificationCompat.Builder(getApplicationContext(), NotificationChannelNames.GPSLOGGER_DEFAULT)
.setSmallIcon(R.drawable.notification)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.gpsloggericon3))
.setPriority( preferenceHelper.shouldHideNotificationFromStatusBar() ? NotificationCompat.PRIORITY_MIN : NotificationCompat.PRIORITY_LOW)
Expand All @@ -566,22 +553,20 @@ private Notification getNotification() {
}
}



nfc.setContentTitle(contentTitle);
nfc.setContentText(contentText);
nfc.setStyle(new NotificationCompat.BigTextStyle().bigText(contentText).setBigContentTitle(contentTitle));
nfc.setWhen(notificationTime);

//notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
//notificationManager.notify(NOTIFICATION_ID, nfc.build());
//notificationManager.notify(NotificationChannelNames.GPSLOGGER_DEFAULT_ID, nfc.build());
return nfc.build();
}

private void showNotification(){
Notification notif = getNotification();
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notif);
notificationManager.notify(NotificationChannelNames.GPSLOGGER_DEFAULT_NOTIFICATION_ID, notif);
}

@SuppressWarnings("ResourceType")
Expand Down Expand Up @@ -1092,6 +1077,7 @@ private void writeToFile(Location loc) {
}
catch(Exception e){
LOG.error(getString(R.string.could_not_write_to_file), e);
Systems.showErrorNotification(this, getString(R.string.could_not_write_to_file));
}

session.clearDescription();
Expand Down Expand Up @@ -1192,6 +1178,14 @@ public void onEvent(CommandEvents.LogOnce logOnce){
}


@EventBusHook
public void onEvent(CommandEvents.FileWriteFailure writeFailure){
Systems.showErrorNotification(this, getString(R.string.could_not_write_to_file));
if(writeFailure.stopLoggingDueToNMEA){
LOG.error("Could not write to NMEA file, stopping logging due to high frequency of write failures");
stopLogging();
}
}

@EventBusHook
public void onEvent(ProfileEvents.SwitchToProfile switchToProfileEvent){
Expand Down
Loading