Giter Site home page Giter Site logo

Comments (59)

nodoubtman avatar nodoubtman commented on June 5, 2024 2

Hi, I tried the script through an ESP32 programmed from the Arduino IDE (1.8.9) sending to a Samsung Galaxy S8 Android phone.
The text portions do come through to the phone only if the App is open. Additionally no notifications come in, and if any parameters such as the r or p are changed to a value, the script yields no result at the phone at all.
I also tried from the on-line dashboard to send a message, and the phone responds PERFECTLY. Notifications work, sound works, etc. So I am left to conclude that the problem lies with the script. I'm a very newbie, so I really don't know where to begin to troubleshoot. I'm hoping a fully workable version with notifications and sound could be made with a bit of tweaking by a knowledgeable person.

in the url:
input.url = "https://www.pushsafer.com";

CHANGE https to http

working flawless :)

THanks.
Marc.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

Hi,

can you post your arduino script!

to understand

  • from arduino you get no push, but you see the messages in the client app
  • from cli the push works

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

// Using an ESP-WROOM-32 version of a NODEMCU
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiScan.h> // gray, not red color in the Arduino IDE
#include <WiFiServer.h>
/#include <WiFiClientSecure.h>/
#include <WiFiClient.h>
#include <Pushsafer.h> // gray, not red color in the Arduino IDE

// Initialize Wifi connection to the router
char ssid[] = "My_SSID"; // your network SSID (name)
char password[] = "My_Password"; // your network key

// Pushsafer private or alias key
#define PushsaferKey "My_PushsaferKey"

/WiFiClientSecure client;/
WiFiClient client;
Pushsafer pushsafer(PushsaferKey, client);

void setup() {
Serial.begin(115200);

// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);

// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}

Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

pushsafer.debug = true;

// Take a look at the Pushsafer.com API at
// https://www.pushsafer.com/en/pushapi

struct PushSaferInput input;
input.message = "This is a test message From ESP32";
input.title = "Hello Bryan!";
input.sound = "8";
input.vibration = "2";
input.icon = "149";
input.iconcolor = "#66ffff";
input.priority = "2";
input.device = "a";
input.url = "https://www.pushsafer.com";
input.urlTitle = "Open Pushsafer.com";
input.picture = "";
input.picture2 = "";
input.picture3 = "";
input.time2live = "";
input.retry = "";
input.expire = "";
input.answer = "";

Serial.println(pushsafer.sendEvent(input));

Serial.println("Sent");
}

void loop() {
}

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Thank you for looking into this! It is very much appreciated. "My" code is above. Other than library changes to get it to compile for the ESP-WROOM-32 version of a NodeMCU, it is virtually unchanged from the example code.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Also, the phone is on Android V9.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

can you take a look in the arduino debug log and post the response!
Please take a look at the faq for Android 8+ devices
https://www.pushsafer.com/en/faq#answer27

Kevin

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Correct. I have all of the notifications On. One difference, is that once a custom sound is selected, the App provided sound disappears and is no longer available. I have setup a custom sound and was not able to return the App to the original state. Custom sounds do trigger from the Web. I had tried to reinstall the App, but it kept the state from the previous load.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Debug log as of just now, this does not always show up:

C:\Users\Owner\Documents\Arduino\libraries\pushsafer-arduino-library-master\src\Pushsafer.cpp: In member function 'String Pushsafer::sendEvent(PushSaferInput)':

C:\Users\Owner\Documents\Arduino\libraries\pushsafer-arduino-library-master\src\Pushsafer.cpp:133:10: warning: unused variable 'c' [-Wunused-variable]

 char c;

      ^

Sketch uses 658950 bytes (50%) of program storage space. Maximum is 1310720 bytes.
Global variables use 38352 bytes (11%) of dynamic memory, leaving 289328 bytes for local variables. Maximum is 327680 bytes.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I just ran it again, and no such message appears... But I have seen the message before.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

The message appears upon any new full debug / compile; anytime the debug option changes.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I cleared all data from the phone as well as the cache regarding Pushsafer. That did allow me to return to the default sound as "App provided sound." However, it still will not push Notifications unless the App is up, and still no sound or Icon ever shows outside of the App.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

Hello,

to check if the arduino script or your phone not work correctly.
Please copy this script into a .html file and save it to your pc and open it in a browser of your choice.

<script>
var xhttp;
if (window.XMLHttpRequest) {
    xhttp = new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

xhttp.open("POST", "https://www.pushsafer.com/api", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.onreadystatechange = ProcessRequest;
xhttp.send("t="+escape('TEST')+
		   "&m="+escape('THIS IS A TEST')+
		   "&d=[YourDeviceID]"+
		   "&k=[YourPrivateKey]"+
		   "&i=82"+
		   "&s=8"+
		   "&v=3"+
		   "&u="+escape('https://www.google.de?q=test')+
		   "&ut="+escape('Google Search')
		  );

function ProcessRequest() {
	document.write('ReadyState: '+xhttp.readyState+'<br>');
	document.write('Status: '+xhttp.status+'<br>');
	document.write('ResponseText: '+xhttp.responseText+'<br>');
}
</script>

change the values in []

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Running the above script yields the following in the browser window:

change the values in []

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Oops, sorry. I probably need to fill in some values before it will work. Sorry. Let me try again.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Sorry, am I missing something? I filled out the &d, and &k parameters, still receive the same result: " change the values in []"

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I ran it both in Chrome and IE (running on Windows7 machine). IE says: "Internet Explorer restricted this webpage from running scripts or ActiveX Controls." I clicked the popup "Allow Blocked Content" but no change.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

OK, I manipulated the script a bit. Now I have a message! "ReadyState: 2"

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

It flashes:
"ReadyState: 1
Status: 0
ResponseText:
change the values in []"

Then clears the screen and says:
"ReadyState: 2"

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

That was from my PC... I emailed the script to my phone and I get this response from the phone browser:
"ReadyState: 2
Status: 250
ResponseText:
ReadyState: 3
Status: 250
ResponseText: {"status":0,"error":"invalid key"}
ReadyState: 4
Status: 250
ResponseText: {"status":0,"error":"invalid key"}"

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

invalid key = check it

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

ReadyState: 2
Status: 200
ResponseText:
ReadyState: 3
Status: 200
ResponseText: {"status":1,"success":"message transmitted","available":984,"message_ids":"4076363:16216"}
ReadyState: 4
Status: 200
ResponseText: {"status":1,"success":"message transmitted","available":984,"message_ids":"4076363:16216"}

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-090118_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-090105_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-090058_Settings

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

OK the push transmitted correctly to the google server!

What you can set under "Set as Default"?

Mostly battery managers prevent receiving push notifications correctly.
Open System settings, then Advanced Settings, then Battery Manager, and finally Protected apps. Enable the toggle next to Pushsafer to allow it to keep running even after the screen is turned off.

For Samsung Devices
Exclude the Pushsafer app from any of the battery optimization features on your device. You'll find these in Settings, then Battery. You'll need to disable battery optimization for the Pushsafer app, as well as checking to make sure the Restrict background data setting is disabled.

Here is a really good blog post to fix broken push notifications
https://www.forbes.com/sites/bensin/2017/05/05/samsungs-battery-paranoia-broke-the-galaxy-s8s-push-notifications-just-like-chinese-smartphones/#4926bb1e7a91

Please leave a feedback

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-112629_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Sorry, while it was off, that does not appear to be the problem. Still no change.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-113635_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

OK, after further testing, what the Forbes article actually does makes it so that the full App doesn't stop running in the background... until you click "Close All' or swipe the App off of the active list. Still, no Icon or light notification works even then. Sound comes through. If one hits the "Close All Apps" or swipes the App off (closing it in Android 9), then nothing at all works again. Still, under no circumstances does anything appear as an Icon, no status light blinks, no notification in the upper bar.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

please try the following

Send the notifications out of your pushsafer dashboard (website)
https://www.pushsafer.com/en/dashboard#anchorsend

  1. send a push notification while the app is in front
  2. send a push notification while the app is in background
  3. send a push notification while the app fully closed

i credited you some extra api calls for testing!

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

i think the app should run in background, here a post
https://updato.com/how-to/manage-android-apps-running-background

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I looked at" set under "Set as Default". While most Apps on the phone are listed, Pushsafer is not.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Case - Results:

  1. send a push notification while the app is in front - Message visible, sound and nearly immediate response in window.
  2. send a push notification while the app is in background - Message visible, sound and nearly immediate response in window.
  3. send a push notification while the app fully closed - Nothing.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-121308_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Wondering why you are not listed here in the default choices.

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Now it seems that we are going backward. Now it does not notify with an icon, etc. even from the Web interface... it originally did.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

set as default you can set up with which app an file type should open. not interesting for pushsafer
The app should run in background! This is very important!

Try to set the priority to 2 and also choose a sound in the web interface!

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

can you send a screenshot of the notification channels set up

  • go to preferences > APPs & Notification > Pushsafer > Notifications

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I am unable to find that path in Android 9. Let me understand. The above path should be on my phone or somewhere else?

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

the path is from android 9 > i think on Samsung devices its little different
Please take a look at your first screenshot, normally you should see notification channels Sound 0-60 for the pushsafer app

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

https://www.pushsafer.com/en/faq#answer27

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-170437_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-123214_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190515-171033_Settings

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Are these the spot?

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

notification categories is right
there must be categories called from Sound 1 - Sound 60
do you see different categories for pushsafer app?

If not i think channel not correctly installed while insalling the app!
Please delete all app data frpm pushsafer, deinstall pushsafer, reboot your device and install again!
After that take a look at the notification prefs, if you see theses 60 channels / categories

btw you need to check sound & pop-up

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I have completed that two times before today and once prior to this today. Out celebrating my birthday today. Will do a major App scrubbing and complete reload in the morning and let you know how it turns out. I am very, very appreciative of the work you are doing to help me set this up! Thank you!

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

happy birthday - what a coincidence - today i have my 40. birthday

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Happy Birthday!! I am now 59... getting old. ;-)

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Yesterday night, after all had left my home, I purged my device from the web account. Then purged the cache and data from my phone and uninstalled the App. Then reinstalled a squeaky-clean version of the App. Now, from the Web interface Pictures to follow this message:

Case - Results:

  1. Send a push notification while the app is in front - Message visible, sound and nearly immediate response in window. No Icon.
  2. Send a push notification while the app is in background, sound selected - No sound. No Icon.
    2a) Send a push notification while the app is in background, no sound selected - NO sound and nearly immediate response in window Icon in bar.
  3. Send a push notification while the app fully closed - Nothing. Until booting the App.
  4. Send from ESP32 with App Closed - Nothing. Until booting the App.
    4a) Remove sound variable from Arduino Code - Send from ESP32 - App in background - receive Icon.
    4b) Turn OFF the App in the background - Send form ESP32 - App NOT running in background - RECEIVED ICON! ;-) No colors, no sound. but 2 vibes and the bell icon appeared.... surprise result!

Arduino code: struct PushSaferInput input;
input.message = "This is a test message From ESP32";
input.title = "Hello Bryan!";
input.sound = "";
input.vibration = "2";
input.icon = "73"; //149 is a spigot icon, 73 is a flooding house icon
input.iconcolor = "#66ffff";
input.priority = "2";
input.device = "a";
input.url = "https://www.pushsafer.com";
input.urlTitle = "Open Pushsafer.com";
input.picture = "";
input.picture2 = "";
input.picture3 = "";
input.time2live = "";
input.retry = "";
input.expire = "";
input.answer = "";

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190516-075731_Message+

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Screenshot_20190516-075811_Samsung Experience Home

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

So there must be some incompatibility with the sound code. Because when I used custom sounds before, that is when it stopped working.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

Hi, i have fixed the pushsafer api code when no sound parameter is set. Now the script uses sound=1 when nothing was selected. Please try again!

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

Kind of a step backwards. Now with the above script, which did get a response, now nothing with the app off. No icon, no anything. With the app on, A-a-a-hum sound comes through. What is th "c" variable? I see it when compiling... not used.

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

C = icon color or LED Color >take a look at the api https://www.pushsafer.com/en/pushapi_ext#API-C

I've tested a little with my android 9 device. All works fine!

The problem is, that you dont see the channels

Default
Sound 0
Sound 1 ...

android-notification-channels

Default channel is triggered when no sound was selected s=empty

Currently i have no idea to solve the issue!
I think its a problem with your device, because you are the only one who report this issue!
Sorry!

Do you have installed other app that can manage battery or security preferences!

from pushsafer-arduino-library.

appzer avatar appzer commented on June 5, 2024

in this post the notification categories are described realy good.

https://www.androidcentral.com/how-change-notification-settings-galaxy-phones-one-ui-android-pie

Scroll to How to adjust the notification settings of an individual app in One UI

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

I will check it out. Enjoy your birthday and sleep well! It is true that I do not see what you see. It could be the provider, as Verizon often uses a different Android than the generic. All other Apps I have work fine...

from pushsafer-arduino-library.

bphick avatar bphick commented on June 5, 2024

DO NOT CHANGE ANYTHING! :-) While I don't have the menus, etc. The article above is all the things I have tried before, but I do not have all of the menu options it says that I should (perhaps my provider, Verizon, has customized the menus for my phone.) BUT, I have it working to my satisfaction! I can move forward... ;-) I ended up taking a chance and changing the sound in my phone for the App again (which blew up the App last time). I no longer have "App provided" sound (or a way back to it), but my own custom sound. When triggered with no sound, and the App NOT running in the background, the icon triggers AND my custom sound is played from my phone. As of right now I AM GOOD! Yeah!!! :-) :-) 👍

from pushsafer-arduino-library.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.