2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 22:25:08 +00:00

Package version checks

This commit is contained in:
Albert Vaca
2013-07-04 14:31:47 +02:00
parent de858175b7
commit 79d530e3c4
2 changed files with 6 additions and 4 deletions

View File

@@ -8,10 +8,7 @@ import org.kde.connect.Types.NetworkPackage;
public class PingPackageEmitter extends BasePackageEmitter {
Context context;
public PingPackageEmitter(Context ctx) {
context = ctx;
}
public void sendPing() {

View File

@@ -13,11 +13,12 @@ import java.util.TimeZone;
public class NetworkPackage {
private int mVersion = 1;
private final static int CURRENT_PACKAGE_VERSION = 1;
private long mId;
private String mType;
private JSONObject mBody;
private int mVersion;
private NetworkPackage() {
}
@@ -26,6 +27,7 @@ public class NetworkPackage {
mId = System.currentTimeMillis();
mType = type;
mBody = new JSONObject();
mVersion = CURRENT_PACKAGE_VERSION;
}
public String getType() {
@@ -72,6 +74,9 @@ public class NetworkPackage {
} catch (Exception e) {
return null;
}
if (np.mVersion > CURRENT_PACKAGE_VERSION) {
Log.e("NetworkPackage.unserialize","Version "+np.mVersion+" greater than supported version "+CURRENT_PACKAGE_VERSION);
}
return np;
}