Terminal doesn't update in (iOS) app

I’m guessing this problem is an iOS problem rather than a blynk problem, but just to be sure.

When I start the app for the first time of the day everything works fine, the BLYNK_APP_CONNECTED function calls and works properly and there are no problems. After that if I don’t hard close the app (double tap home screen and swipe it away), the next time I start the app on my phone it doesn’t call BLYNK_APP_CONNECTED and it doesn’t update terminal unless I stop the sketch and restart it.

Is there any way that I could get it to update terminal when the app is running in the background?

That is the normal mode of operation, why did you mention BLYNK_APP_CONNECTED?

Has BLYNK_APP_CONNECTED been released for iOS?

Are your terminal commands just included in the BLYNK_APP_CONNECTED() function?

Yes, BLYNK_APP_CONNECTED works in iOS now, but only after a hard close. The terminal writes are in response to mqtt topic subscribes that are outside of the BLYNK_APP_CONNECTED function. I mentioned BLYNK_APP_CONNECTED because I figured putting in a blynk.syncvirtual call in there for the terminal might fix it, but BLYNK_APP_CONNECTED is only called in the same instances in which the terminal is already updating.

BLYNK_APP_CONNECTED seems to be working fine for you i.e. it is only supposed to work when you “crash” the app. Or specifically it’s twin BLYNK_APP_DISCONNECTED informs you of the crash (double tap home screen and swipe it away) and BLYNK_APP_CONNECTED tells you when you restart the app.

Although it’s nice for a Terminal screen to automatically scroll it sometimes performs better with autoscroll disabled in the app. It stops a lot of the duplicated entries and certainly for Android it shows the terminal writes that occur when the app is closed (just manually scroll back up the window).

So here’s another strange behavior:

I added a button with the following code:

BLYNK_WRITE(V11)
{
  int pinValue = param.asInt();
  if (pinValue == 1)
  {
    Blynk.syncVirtual(V0);
    terminal.println("Updated");
    terminal.flush();
  }
}

I figured this would force the terminal to update and show the missing information without having to stop/start the app. Instead it prints “Updated” on a new line directly after the last shown line. When you stop/start the app after pressing the button it finds the missing entries and places them on top of the “updated” entry. It’s odd to me that when it updates the terminal it doesn’t find those missing entries.

BTW I did turn off autoscroll, no noticeable change in behavior (other than not autoscrolling).

I see what you mean with the Terminal widget not synced after long background. This is something we could improve. Thanks for the feedback.

Not sure about BLYNK_APP_CONNECTED - from my understanding it should be called in such case. If BLYNK_APP_CONNECTED wasn’t called, it means networking connection wasn’t lost, but that means Terminal should be in sync.