typedef struct{
String key;
String value;
} keyValuePair;
keyValuePair field[30];
field[3].key = "FromMe"; field[3].value = String("ESP8266 ChipID: " + (String)ESP.getChipId());
field[4].key = "Title"; field[4].value = "Report house automation state."; // message title
field[5].key = "Message"; field[5].value = "Hi User,\n\n" // message body
"this is your message sent from ESP8266 board,\n"
"the user pressed the button on digital pin 2 to ground. \n\n"
"As you can see, using this library, now we can send multilines notification \n"
"messages from ESP8266 or Arduino boards, to Android devices.\n\n"
"Best regards.\n\n"
"Your development board";
field[6].key = "Data1"; field[6].value = String("ADC value: " + (String)analogRead(A0)); // notify ADC value
String D3_State = (digitalRead(0) == LOW) ? "LOW" : "HIGH";
String D4_State = (digitalRead(2) == LOW) ? "LOW" : "HIGH";
field[7].key = "Data2"; field[7].value = String("GPIO0: " + D3_State); // notify GPIO0-D3 state
field[8].key = "Data3"; field[8].value = String("GPIO2: " + D4_State); // notify GPIO2-D4 state
field[9].key = "Data4"; field[9].value = 23520000;
field[10].key = "Data5"; field[10].value = "This is data5 value in String format";
field[11].key = "Data6"; field[11].value = String("1356.2345 * 642.789 = " + (String)(1356.2345 * 642.789));
field[12].key = "Data7"; field[12].value = String("Latitude: " + String(45.89098098,10));
field[13].key = "Data8"; field[13].value = String("Longitude: " + String(54.99576546,10));
field[14].key = "Light"; field[14].value = "true"; // we can specify if want the devive to blink led on notifications. By default true if no called.
field[15].key = "Sound"; field[15].value = "true"; // we can specify if want the device to play sound on notifications. By default true if no called.
field[16].key = "Vibrate"; field[16].value = "true"; // we can specify if want the device to vibrate on notifications. By default true if no called.
field[17].key = "SpeakLanguage"; field[17].value = "en"; // we can send voice notifications using Speak commands
field[18].key = "SpeakCountry"; field[18].value = "US";
field[19].key = "SpeakRate"; field[19].value = .8;
field[20].key = "SpeakPitch"; field[20].value = 1.0;
String msgToSpeak = field[5].value;
msgToSpeak.replace("\n", " "); // we replace all \n with spaces to remove voice pause on every line of message
msgToSpeak.replace("ESP8266", "E S P 8 2 6 6");
field[21].key = "Speak"; field[21].value = msgToSpeak;
field[22].key = "Duration"; field[22].value = 25000; // we can set the message popup duration measured in milliseconds (by default 3000ms = 3 secs)
// fcm.field[23].key = "Insistent"; fcm.field[23].value = "true"; // we can use insistent notification, this play notify sound repeatedly until the user
// press on notification message, good for alarms
String Topics[] = {"general","mouse","cat"};
success = sendMessage(Topics, 3);
Serial.println((success == true) ? "Message sent successfully."
: "Unable to send message"