diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java
index 658868044..fbf168a94 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java
@@ -68,6 +68,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -530,6 +531,9 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
} else if (itemId == R.id.activity_action_dev_share_raw_details) {
shareRawDetails(ActivitySummaryDetail.this, currentItem);
return true;
+ } else if (itemId == R.id.activity_action_dev_share_json_details) {
+ shareJsonDetails(ActivitySummaryDetail.this, currentItem);
+ return true;
}
return super.onOptionsItemSelected(item);
}
@@ -627,6 +631,21 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
}
}
+ private static void shareJsonDetails(final Context context, final BaseActivitySummary summary) {
+ if (summary.getSummaryData() == null) {
+ GB.toast(context, "No json details in this activity", Toast.LENGTH_LONG, GB.WARN);
+ return;
+ }
+
+ final String jsonSummaryFilename = FileUtils.makeValidFileName(String.format("%s.json", DateTimeUtils.formatIso8601(summary.getStartTime())));
+
+ try {
+ AndroidUtils.shareBytesAsFile(context, jsonSummaryFilename, summary.getSummaryData().getBytes(StandardCharsets.UTF_8));
+ } catch (final Exception e) {
+ GB.toast(context, "Unable to share json details: " + e.getMessage(), Toast.LENGTH_LONG, GB.ERROR, e);
+ }
+ }
+
private void updateMenuItems() {
boolean hasGpx = false;
boolean hasRawSummary = false;
diff --git a/app/src/main/res/menu/activity_take_screenshot_menu.xml b/app/src/main/res/menu/activity_take_screenshot_menu.xml
index 45272b70b..4b972a5d4 100644
--- a/app/src/main/res/menu/activity_take_screenshot_menu.xml
+++ b/app/src/main/res/menu/activity_take_screenshot_menu.xml
@@ -43,6 +43,11 @@
android:id="@+id/activity_action_dev_share_raw_details"
android:title="@string/activity_detail_share_raw_details"
app:showAsAction="never" />
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fb99e41cf..e4a673018 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2286,6 +2286,7 @@
Share GPS Track
Share Raw Summary
Share Raw Details
+ Share JSON Details
GPS track
Dev Tools