[SOLVED] Push notification doesn't work on iPhone when blynk app project window is closed

I’m using an iphone5 and I’m having a problem with push notifications working when the blynk project window is closed. When it’s open is the only time I can receive push notifications. I’m using the latest blynk version for iOS devices on my phone.

Hello. Do you use “HIGH” priority for push widget?

I tried that but it didn’t make a difference.

I have the same problem when I use the email widgit. If the project window is open I will get a notification by email, but if I close the window I don’t get anything.

We have a 1 minute limit. Maybe this is a case? Also are you sure you didn’t stop your project?

I don’t have a provision in the code to limit the push notification to one per minute, but I don’t think I’m exceeding that. As far as is the program being stopped goes, I think it’s running, but the behavior is as though that’s not the case. When I’m looking at the project and have it in the run mode and I push the home button on my phone I’m assuming the the project is still running in the background? I’m using an esp8266 with a sensor to detect water for the devices. Through the serial port I can see that the command to push data and to email is being seen when water is detected.

@Drcottrell Regarding push, please check your settings. There is a chance you didn’t allow any within your apple setting. Also please post your code.

@ashvetsov any suggestions?

This is the code that I’m using for my water detection project. I’ve commented out some of the code lines for various reasons, in some cases it just wasn’t needed.
I couldn’t find anything in the apple settings that was turned off in terms of notifications, but I noticed that if I turn the notifications of in Blynk from the settings window on the iphone that I still will receive notifications if the project window is open. I didn’t expect that. I also have noticed, regarding email notifications, that if the project window is closed in Blynk with the app running that I will receive an email notification if water is detected, but I will only see it or be aware that it exists if I open my email. There’s no audible or visual indication that an email was received. Normally I get an audible indication if an email comes in. That’s a setting I can control in the phone. Once the email window is open it takes sometime for the notification to download and show.

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = “47de0b0866c742c5b3bbb43438246bb0” ;
int waterSolenoid = 2;
void setup() {
// put your setup code here, to run once:
Blynk.begin(auth, “xxxxxxxxx”, “xxxxxxxxxx”);
while (Blynk.connect() == false) {
// Wait until connected

// Notify immediately on startup
// Blynk.notify(“Device started”);
// attachInterrupt(digitalPinToInterrupt(0), notifyDetection, CHANGE);

pinMode(waterSolenoid, OUTPUT);
void loop() {
// put your main code here, to run repeatedly:

int sensorValue = analogRead(0);
int waterDetected = map(sensorValue, 0, 1023, 0, 100);

if (waterDetected >= 20) {
// delay(200);
Serial.println(“water detected”);
Blynk.email("drcottrell@comcast.net", “water detection”, “water was detected”);
BLYNK_LOG(“Presense Detected.”);

Blynk.notify("water detected");
digitalWrite(waterSolenoid, HIGH);


else {
// delay(200);
Serial.println(" Dry");
digitalWrite(waterSolenoid, LOW);

//void notifyDetection(){

Please try to remove delays. It could be a reason

I did remove the delays, but that didn’t make a difference with the push notification.

You can use the SimpleTimer (see the PushData example) to run a function every x-time. This is a better means of executing code in a timed fashion. It may help to do this and keep void loop() as clean as you can. E.g. just initialize timer and blynk. As per the example :slight_smile:

I’ll try that when I can log on to Blynk. I haven’t been able to log on all day and I get a message saying “sorry, server can’t talk now. try later”. I don’t know if that’s on my end or a server issue.

It was the cloud service, the hosting party unexpectedly performed maintenance on the blynk servers unfortunately.

Is that why I have no functionality out of Blynk now?
Even the most basic function of turning an LED on and off with a widget push button doesn’t work. Do I need to reinstall Blynk?
I tried pinging Blynk-iCloud.com from my PC but got a could not find host message.

DNS should really be updated by now. Can you try using the Google DNS servers instead of your ISP ones? and

I tried that but it didn’t make any difference.
I’m trying to install a new library for Blynk into the arduino 1.6.5 IDE. So far that hasn’t help, but I don’t think the newest library is being recognized. In the serial port I see a message every few seconds saying connecting to cloud.blynk.cc:8442.
At present my Blynk app is not functional.

You are still using the old libraries than I think.

If you want to install the newest library, you have to manually download the zip file and extract the files to the library directory, do NOT do it via the Arduino IDE, it won’t work since there are multiple libraries in the zip package and the IDE doesn’t know how to properly handle that :slight_smile:

I installed the most recent Blynk library and copied the necessary files into my project program and that restored the functionality with the Blynk app and it also appears that the push notification works as expected now.

1 Like