No native ios library to configure/setup wifi on p2


we have a product using the p1 and are now forced to use the p2

our product (with the p1 and now p2) is configured (setup wifi to start with) using our app on the phone. particle release some code to show how this is done on android but will not release a native library or example on how to do this on ios. the old native library does not work as it is all different now using ble (and again different from argon). we only got the react example with which our ios app developer cannot work

anyone having the some problem? any already has some working ios code they like to share?



I haven’t tried the P2 yet, but maybe this library can help you:
BLE WiFi Setup Manager Library

I built an Android app that connects with an Argon running the library and works fine.
I did not see anything Android-specific in that library, hence I would think your iOS developer can use it.

More on the app here:

In that topic, we talk about a few things to have in mind, at least on the Argon, not sure about the P2.

thanks gusgonnet

unfortunately the p2 is again different and ble setup is not compatible with argon

it is using a particle supplied mobile secret (unique per p2) for ec j-pake and aes to communicate


this library I mentioned uses setCredentials() - WiFi | Reference | Particle which I would believe the P2 supports also.

I think what you mention is the INITIAL setup. That this library can’t do for sure.
But if you are able to do an INITIAL setup, then ship the P2s, your customers could then setup the Wi-Fi with this library.

I suggest you try.
Best of luck!

will try and let you know! thanks so much, frank

works! nice gusgonnet/dan-kouba. we are still hoping we get a lib from particle but this is definitely a good fall back

so happy,

that is great to hear!

we do like to add a little bit of “security” - right now the password goes plain text over the air

the particle-ble-configure methode (for p2) uses the mobile secret to encrypt/hash. we like to use this as it is known on both sides and not to others (and when/if particle gets it act together we might switch to their methode)

but is there a way to get the to the mobile secret on the p2?

The mobile secret is encoded in the data matrix code on the Particle serial number sticker on the top of the P2.

The text is (serial number) (space) (mobile secret). This is why the camera needs to scan the sticker in the Particle mobile apps to set up an Argon.

hi rickkas7,

i know it is how to get it “outside” the p2 (from the datamatrix or from the particle cloud) but it must also be accessible “inside” the p2 (to make the secure setup possible). but how?


Oh, sorry, I misread that. This worked for me:

#include "Particle.h"

#include "deviceid_hal.h"

SerialLogHandler logHandler;

void setup() {
    waitFor(Serial.isConnected, 10000);

    char buf[32];
    hal_get_device_secret(buf, sizeof(buf), NULL);"secret %s", buf);

void loop() {

1 Like

ah, nice, the “secret” way to get the “secret”!

1 Like