Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Rom's FlaFla
    @ralbasini_twitter
    Sorry, but situation is still the same...
    I'm getting timeout, and hardly ever a match, whenever a pub and sub were finally successfully sent
    GiacL
    @GiacL
    Hi, the function startUsingMainDevice() should be called everytime we do a matchmore action or we can just call it at the start of the app?
    Łukasz Młynik
    @lmlynik
    just at the start of the app, you have then convenience methods like createPublicationForMainDevice if you want to used, also other calls of startUsingMainDevice can be issued with the callback to get access to the main device object
    GiacL
    @GiacL
    thank you
    GiacL
    @GiacL
    how create a pinDevice in android? I don't understand how the method matchMore.createPinDevice() work
    GiacL
    @GiacL

    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

    Łukasz Młynik
    @lmlynik
    @GiacL in the android sdk all calls are asynchrnous, so it is very likely that this.pID is not set yet while calling publication creation. So it will be null which will cause that it will take the your main device id
    GiacL
    @GiacL
    Are they issue with MatchMore today? Whe i try my app with matchmore code it fail... when i put the matchmore code in comment my app works fine again
    GiacL
    @GiacL
    @lmlynik yes but i see in a toast just before that i got the pinDeviceId, i just put in pID after to use it during the publication creation
    wenjdu
    @wenjdu
    So when calling createPublication(), you have two methods with the same name:
    One is createPublication(Publication)
    The other is createPublication(Publication, String) <-- -- You want to use this one because the second parameter String is filled with the device id on which you want to attach the publication
    @GiacL
    qwunsche
    @qwunsche
    I'm using createPublication(Publication, String) but I have an error saying "cannot resolve method", did I fill it wrong?
        Publication publicationConf2 = new Publication("conference2", 20d, 2000d);
        matchMore.createPublication(publicationConf2, "df8dbde6-326c-49f1-82a1-a5cbffeb1290");
    wenjdu
    @wenjdu
    matchMore.createPublication(publication, "deviceIdExample",
                        createdPublication -> {
                    return INSTANCE; },
                        e -> {
                    return INSTANCE; }
                        );
    Did you add the asynchronous callback ?
    wenjdu
    @wenjdu
    @qwunsche
    GiacL
    @GiacL
    he will com back in a moment
    it works, ty
    GiacL
    @GiacL
    @wenjdu my test was wrong, it created once again with my device id and not the pinDeviceID
    wenjdu
    @wenjdu
    Could you copy paste your code here please
    With markdown if possible
    GiacL
    @GiacL

    ``` (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;

        });

    ```

    sorry don't know how it's work markdown
    wenjdu
    @wenjdu
    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;
    it should be working
    what errors messages you get in the log ?
    GiacL
    @GiacL
    got no error message
    The publication is created, but it takes my deviceID and not the pinDeviceID
    when i see the match
    wenjdu
    @wenjdu
    Log.d("TARTATIN", createdPublication.toString());
    then do you see something in the log debug ?
    GiacL
    @GiacL
    04-16 13:35:30.708 8167-8167/ch.giacomolonghi.unilapp D/TARTATIN: Publication(topic=conference, range=3330.0, duration=3330.0, properties={}, deviceId=448af123-5b92-4b2b-b249-160b57434c2b, worldId=null, createdAt=1523878530656, id=07808e0b-7e66-4493-9bf9-550476c0235b)
    wenjdu
    @wenjdu
    deviceId=448af123-5b92-4b2b-b249-160b57434c2b is it the id of your pin ?
    GiacL
    @GiacL
    no it's the id of my device
    wenjdu
    @wenjdu
    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 -> {
    Can you log the pin device id
    and compare
    it shouldn't be your main device id in the publication
    GiacL
    @GiacL

    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)

    wenjdu
    @wenjdu
    Can you matchmore.createPublication(yourPublication, "40bdeb11-b03a-4823-81bb-33b99e5cfbf2")
    Try it like that and give me the log again
    GiacL
    @GiacL
    04-16 13:46:21.858 12556-12556/ch.giacomolonghi.unilapp D/TARTATIN: Publication(topic=conference, range=3330.0, duration=3330.0, properties={}, deviceId=40bdeb11-b03a-4823-81bb-33b99e5cfbf2, worldId=null, createdAt=1523879181841, id=2e825852-a1de-41f2-9d10-c46722e6783b)
    wenjdu
    @wenjdu
    ok see you are publishing on the right device id now
    GiacL
    @GiacL
    yeah but i put the String directly, i can't put that in a variable?
    wenjdu
    @wenjdu
    So I think the issue is related with the value you store inside of your variable this.pinID
    GiacL
    @GiacL
    ok, thank you
    wenjdu
    @wenjdu
    Yes you definately can but be careful with the callbacks
    GiacL
    @GiacL
    thanks
    wenjdu
    @wenjdu

    When there is asynchronous calls, you have to make sure that async call One is finished before async call Two is launched. Especially, when you need a value that is returned with async call One.

    In your case, you have pinID which is supposed to be store at the end of the async call One, but if your async call Two is called before async call One is done. Then you will have pinID = null, which lead to the case where createPublication(publication, null) == you create a publication for your main device.