Connecting multiple Apps to the same NodeMCU

Hi,

I am trying to connect two or more different Apps (can be the same App as well) to the same NodeMCU board. I do have two different tokens. Inside the loop I am replacing the configStore.cloudToken every cycle. I can see it is connecting but I only do one BlynkProvisioning.begin(); (to the iPhone App token). When I am running both Apps, I can see the GPS stream information of one unit (Android) getting into the NodeMCU when I am using the other token. I would expect to get information ONLY from the device that the current token belong to it.
Any idea why this can happen?
The code example:

 void loop() {
      if(TokenID==0)
      {
        CopyString( Token0, configStore.cloudToken);
        TokenID=1;
        Serial.printf( "Phone Token");
      }
      else
      {
        CopyString( Token1, configStore.cloudToken);
        TokenID=0;
        Serial.printf( "Tablet Token");
      }
      Serial.printf( "Token Now: %s\n", configStore.cloudToken);
      BlynkProvisioning.run();
    }

Thanks
Sharon

@szohar please edit your post and add triple backticks at the beginning and end of your code.
Triple backticks look like this:
```

Pete.

Done.
Thanks

The configStore structure is obviously wasn’t expected to be accessed directly. And the whole scenario - changing device token on the fly is not a supported Blynk flow.

In Blynk, device authentication happens during its first network connection to the server.

So how can you use one HW device with multiple users? Sounds as a very typical use.

What is the end goal use-case for it?

Most likely it can be achieved in a business version.

You can generate a link so multiple users can use the one app though

That is correct but since I am using the GPS in my App each user can be in a different location and that can create an issue for my solution if I don’t know who is where.

It really does depend on what you’re trying to achieve, but it’s extremely simple for commands coming from multiple Auth codes to control the same piece of hardware if you use Node-Red and MQTT.

Node-Red can have multiple Blynk connections defined and active at the same time, and you control the logic of what you do with the incoming instructions. If you want to send them all to the same device, via MQTT messages, then you can.
In the same way, you can publish data from the single hardware device to as many, or as few, of the Blynk connections as you wish.

Pete.

GPS widget sends 4th parameter which is a device ID. Not sure it was implemented on Android, but it should work on iOS

Thanks Pavel, I can see it on iOS but not on Android.

I was also trying to use on Android the GPS trigger but can’t find in the documentation how to set the distance for the trigger.

Thanks
Sharon

I’ve read mention of the 4th parameter being passed as a device ID. How does one discover this kind of information (source code?) ? Are there other places where this device ID is being passed to the device?