Przejdź do głównej zawartości

Posty

Wyświetlanie postów z 2018

Tidy #includes

Tidy #includes Having tidy includes in C++ project is often thought as low priority. It can however help you with making your code less fragile. This is doubly important when your project is a library that will be used by other people.
I propose that "good" includes should follow those rules:
Associated header (foo.hpp for foo.cpp) always comes firstAny file should have all the headers it needs. System headers are in <angle_brackets>, project headers are in "quotes"Project headers are first, STL headers are last, between them are libraries in order of decreasing locality.Use #pagma once instead of include guards Within groups decided by 4), alphabetic order is nice to have.  Associated header is first The header that declares class / methods should be the first to include. It also should have the same file name as current source file, except for extension. Some tools depend on this - for example IDEs use this to implement "go to declaration/implementatio…

Sending Firebase Messages from command line with curl

Google Firebase platform is set of services aimed at "cloudyfying" Android apps. One of those services is FCM, Firebase Cloud Messaging, and allows us to send short text or data messages to device or group of them.
Majority of tutorials show how to send this message from another Android device. This one will show how to send it from custom server, for simplicity using curl program. 
Steps needed:
Set up project in Firebase consoleCompile example app for this projectVerify sending works with web uiSend message using curl Set up project in Firebase consoleGo to https://console.firebase.google.comClick Add projectEnter project name and click CreateOn the left menu select Grow / NotificationClick Android icon Enter package name. For this tutorial enter com.google.firebase.quickstart.fcmClick Register App, then Download google-services.json and save the fileFollow rest of instructions on website or in this tutorial Compile example appCheck out project firebase/quickstart-android
g…