i manage to do this:
PinDevice pinDevice = new PinDevice("pinDeviceTransport", new MatchMoreLocation(32L,46.52214476,6.64595656) );
matchMore.createPinDevice(pinDevice, createdPinDevice ->{
Toast.makeText(getApplicationContext(), "pinDevice créé", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "pinDeviceID = " + createdPinDevice.getId(), Toast.LENGTH_SHORT).show();
this.pID = createdPinDevice.getId();
return Unit.INSTANCE;
}, e -> {
Toast.makeText(getApplicationContext(), "erreur creation pinDevice: " + e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});
Publication publicationConf = new Publication("conference", 3000d, 3000d, m, pID);
matchMore.createPublication(publicationConf, createdPublication ->{
Toast.makeText(getApplicationContext(), "Publication créée", Toast.LENGTH_SHORT).show();
Log.d("TARTATIN", createdPublication.toString());
return Unit.INSTANCE; // return Unit.INSTANCE; is important (b/c kotlin vs java lambdas differ in implementation)
}, e -> {
Toast.makeText(getApplicationContext(), "erreur creation publication: " + e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});
BUT, the proble is that the publication created got my deviceID and not the id i put with pID
Publication publicationConf2 = new Publication("conference2", 20d, 2000d);
matchMore.createPublication(publicationConf2, "df8dbde6-326c-49f1-82a1-a5cbffeb1290");
``` (shift+enter for line break)
var code = "formatted";
PinDevice pinDevice = new PinDevice("pinDeviceTransport", new MatchMoreLocation(32L,46.52214476,6.64595656) );
matchMore.createPinDevice(pinDevice, createdPinDevice ->{
Toast.makeText(getApplicationContext(), "pinDevice créé", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "pinDeviceID = " + createdPinDevice.getId(), Toast.LENGTH_SHORT).show();
this.pinID = createdPinDevice.getId();
return Unit.INSTANCE;
}, e -> {
Toast.makeText(getApplicationContext(), "erreur creation pinDevice: " + e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});
Publication publicationConf = new Publication("conference", 3330d, 3330d);
matchMore.createPublication(publicationConf, pinID, createdPublication ->{
Toast.makeText(getApplicationContext(), "Publication créée", Toast.LENGTH_SHORT).show();
Log.d("TARTATIN", createdPublication.toString());
return Unit.INSTANCE; // return Unit.INSTANCE; is important (b/c kotlin vs java lambdas differ in implementation)
}, e -> {
Toast.makeText(getApplicationContext(), "erreur creation publication: " + e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});
```
matchMore.createPinDevice(pinDevice, createdPinDevice ->{
Toast.makeText(getApplicationContext(), "pinDevice créé", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "pinDeviceID = " + createdPinDevice.getId(), Toast.LENGTH_SHORT).show();
this.pinID = createdPinDevice.getId();
return Unit.INSTANCE;
}, e -> {
04-16 13:39:55.432 11508-11508/ch.giacomolonghi.unilapp D/pinid: 40bdeb11-b03a-4823-81bb-33b99e5cfbf2
04-16 13:39:55.457 11508-11508/ch.giacomolonghi.unilapp D/TARTATIN: Publication(topic=conference, range=3330.0, duration=3330.0, properties={}, deviceId=448af123-5b92-4b2b-b249-160b57434c2b, worldId=null, createdAt=1523878795430, id=6a564909-871f-403b-9920-82df8bd61c3c)