diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWInstallHandler.java index 1619467b..4071c83d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWInstallHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWInstallHandler.java @@ -3,6 +3,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.pebble; import android.content.Context; import android.net.Uri; +import org.json.JSONException; +import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -158,10 +160,18 @@ public class PBWInstallHandler implements InstallHandler { } try { LOG.info(app.getJSON().toString()); - writer.write(app.getJSON().toString()); + JSONObject appJSON = app.getJSON(); + JSONObject appKeysJSON = mPBWReader.getAppKeysJSON(); + if (appKeysJSON != null) { + appJSON.put("appKeys", appKeysJSON); + } + writer.write(appJSON.toString()); + writer.close(); } catch (IOException e) { LOG.error("Failed to write to output file: " + e.getMessage(), e); + } catch (JSONException e) { + LOG.error(e.getMessage(), e); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java index ad8f6e11..e463dd44 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PBWReader.java @@ -58,6 +58,8 @@ public class PBWReader { private int mIconId; private int mFlags; + private JSONObject mAppKeys = null; + public PBWReader(Uri uri, Context context, String platform) throws FileNotFoundException { this.uri = uri; cr = context.getContentResolver(); @@ -201,6 +203,10 @@ public class PBWReader { appCreator = json.getString("companyName"); appVersion = json.getString("versionLabel"); appUUID = UUID.fromString(json.getString("uuid")); + if (json.has("appKeys")) { + mAppKeys = json.getJSONObject("appKeys"); + LOG.info("found appKeys:" + mAppKeys.toString()); + } } catch (JSONException e) { isValid = false; e.printStackTrace(); @@ -317,4 +323,8 @@ public class PBWReader { public int getIconId() { return mIconId; } -} \ No newline at end of file + + public JSONObject getAppKeysJSON() { + return mAppKeys; + } +}