Hi all. I’m returning to Blynk after a few years, this time with ESP32. I have an Android and an iPad running the updated Blynk apps, using Arduino IDE.

I am finding that neither BLYNK_APP_CONNECTED(), BLYNK_APP_DISCONNECTED() are working.
I can freely read and write to the Blynk mobile app widgets - no problem.

I cannot detect if the mobile Blynk apps are connected or not using the BLYNK_APP_CONNECTED(), BLYNK_APP_DISCONNECTED() code.

I did see the similar post and resolution from a while back, but I’m still stuck, even with updated apps.

Is this my bad ? A returning newbie error?
Thanks all.

#ifndef ESP32
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "myAuthCode";
char ssid[] = "mySSID";
char pass[] = "myKeyCode";

int pushToPhoneTimerID;  //for changing the interval for the Push-To-Phone timer
const long int slowTimer = 5000L;  // 5 seconds when no app connected

// Ambient Brightness from phone or device on V7
int phoneBrightness;  

// insideBrightness controlled by app sliders
int insideBrightness; 

bool appConnected = false;  

BlynkTimer pushToPhoneTimer;

void setup()
  Serial.begin ( 115200 );

  Serial.println ( "STARTING Blynk_Working_Test_ESP32 ANDROID.\n\n" );  
  Blynk.begin ( auth, ssid, pass );

  Serial.println ( "Blynk begin completed.\n" );  
  // Setup a function to be called every second
  pushToPhoneTimerID = pushToPhoneTimer.setInterval ( slowTimer, myUptimeCounter );

  Serial.println ( "Setup complete.\n" );  

void loop()
{;; // Keeps uptime timer up to date

// Inside Brightness 0-1023 on V10
BLYNK_WRITE(V10) // Called when APP makes a change
  insideBrightness = param.asInt(); // assigning incoming value from pin V1 to a variable

  Serial.print ( F ( "V10 Slider changed to: " ) );
  Serial.println ( insideBrightness );

// Ambient Brightness from phone or device on V7 
/* (seen as high at 4000+ from Android);  not implemented on iPad */  
BLYNK_WRITE(V7) // Called when APP makes a change
  phoneBrightness = param.asInt(); // assigning incoming value from pin V1 to a variable

  Serial.print ("V7 Phone Lux value is: ");
  Serial.println ( phoneBrightness );

// This is called when Smartphone App is opened
  Serial.println ( F ( "\n\nApp connected..." ) );  
  appConnected = true;  

// This is called when Smartphone App is closed
  Serial.println ( F ( "\nApp Disconnecting.... " ) );
  appConnected = false;  

/* myUptimeCounter() */
void myUptimeCounter()
  long int countup = millis() / 1000;  
  Blynk.virtualWrite ( V5, countup );
  Serial.print ( F ( "                           " ) );  
  Serial.print ( F ( "V5 timer... " ) );  Serial.print ( countup );  
  if ( appConnected ) Serial.println ( "... connected." );
  else Serial.println ( "... DISconnected." );  

First of all, have you enabled the option in the app project settings?


Thanks, Pete, for the instant reply.
Yes, I have enabled the app sliders for notification.

I do now see two different behaviors from two different Androids! One works (Pixel), one doesn’t (Note8). Go figure.

The iOS iPad app does not trigger the BLYNK_APP_CONNECT() or …_DISCONNECT() routines.
Any perspective on this one?

Are these all on one Auth token?

No. I set each of them up on different tokens. Thanks.

It’ll only work with the Auth token used in the sketch.


Yep. Understood. Thanks for spending time on this. One Android works as expected. iOS does not.
Everything else I’m trying to do with ESP32 and Blynk apps seems to work in both directions.

Might still be me. If you know of anyone getting iOS success on this, any advice would be welcome. But it’s not the ESP32 code, I now see. Might be the iOS app.

I’ll update this if if gets resolved. Thanks again.

It works fine on iOS, I’ve just tested it.

You have to kill the Blynk app by swiping upwards.


Thanks, Pete, for spending time on this. Sounds like I’m still getting back up to Blynk-speed!