Comments (5)
A simple way to use Qtfirebase Real-time data base is this
-
Add a child named "tests" to your Database/Data in firebase consul.
-
Change your Database/Rules (Json file) in your firebase consul to :
{
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
"rules": {
".read": true,
".write": true
}
}
- In your
.h
file include:
QAndroidJniEnvironment *_jniEnv;
::firebase::App* _app;
::firebase::ModuleInitializer _initializer;
QAndroidJniObject _jniObj;
firebase::database::Database *database;
- In your
.cpp
file include:
_jniEnv = new QAndroidJniEnvironment();
QAndroidJniObject jniObject = QtAndroid::androidActivity();
::firebase::App *instance = ::firebase::App::GetInstance();
if (instance) {
qDebug() << "instance already exists";
_app = instance;
} else {
qDebug() << "Creating instance";
jniObject = QtAndroid::androidActivity();
_app = ::firebase::App::Create(*_jniEnv, jniObject.object<jobject>());
}
database=firebase::database::Database::GetInstance(_app);
firebase::database::DatabaseReference dbref = database->GetReferenceFromUrl("Enter Your Real-time Database URL Here");
dbref.Child("tests").SetValue(Add Your Custom Value Here);
from qtfirebase.
Hi! Thanks for your interest!
Is QtFirebase Cloud Storage still unavailable for c++?
Yes, I'm currently unaware of the status. Maybe @Furkanzmc can give you more information on the status. If it's abandoned you're welcome to contribute an implementation!
And I also noticed that real-time database is partially available. What functions are still not accessible?
Correct. It need to be expanded further to cover the complete API. Pull requests are welcome!
A quick grep
through the code base for db::
(namespace db = ::firebase::database
). Reveals this list of calls used:
qtfirebasedatabase.cpp
26: m_db = db::Database::GetInstance(qFirebase->firebaseApp());
qtfirebasedatabase.h
67: firebase::database::Database* m_db;
192: firebase::database::DatabaseReference m_dbRef;
qtfirebasedatabase.cpp
10: , m_db(nullptr)
26: m_db = db::Database::GetInstance(qFirebase->firebaseApp());
230: m_dbRef = qFirebaseDatabase->m_db->GetReference().GetRoot();
234: m_dbRef = qFirebaseDatabase->m_db->GetReference().GetRoot().Child(path.toUtf8().constData());
244: m_pushChildKey = m_dbRef.PushChild().key();
255: firebase::Future<void> future = m_dbRef.RemoveValue();
268: m_dbRef = m_dbRef.Child(m_pushChildKey.toUtf8().constData());
270: firebase::Future<void> future = m_dbRef.SetValue(QtFirebaseService::fromQtVariant(value));
289: firebase::Future<firebase::database::DataSnapshot> future = m_dbRef.GetValue();
302: firebase::Future<void> future = qFirebaseDatabase->m_db->GetReference().UpdateChildren(vfb);
385: m_query.setQuery(m_dbRef.OrderByKey());
392: m_query.setQuery(m_dbRef.OrderByValue());
399: m_query.setQuery(m_dbRef.OrderByChild(path.toUtf8().constData()));
406: m_query.setQuery(m_dbRef.OrderByPriority());
413: m_query.setQuery(m_dbRef.StartAt(QtFirebaseService::fromQtVariant(order_value)));
421: m_query.setQuery(m_dbRef.StartAt(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
428: m_query.setQuery(m_dbRef.EndAt(QtFirebaseService::fromQtVariant(order_value)));
435: m_query.setQuery(m_dbRef.EndAt(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
442: m_query.setQuery(m_dbRef.EqualTo(QtFirebaseService::fromQtVariant(order_value)));
449: m_query.setQuery(m_dbRef.EqualTo(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
456: m_query.setQuery(m_dbRef.LimitToFirst(limit));
463: m_query.setQuery(m_dbRef.LimitToLast(limit));
So the API calls not available, are the ones missing from this list plus what's not present in qtfirebasedatabase.h.
I remember another issue where some of the missing functionality at the time was also mentioned.
So you'll have to do some investigation to find out the exact missing calls I guess.
Thanks for the quick example - much obliged!
(But I still wonder if there is a way to use Qtfirebase Cloud Storage ...)
There is only a way to use Cloud Storage through QtFirebase
if someone contributes a wrap of storage.h - It looks pretty straight forward at first glance. I would be very cool to have it contributed!
... Untill then you're stuck with using it straight from the Firebase C++ SDK as provided by Google
from qtfirebase.
@larpon Hello Larpon.
Thank you so much for your time and the detailed answer. It is all clear now! :) If I come up with a wrapper or find something helpful I will share it with you.
The example I provided is the most basic one just to make sure if you are successfully connected to the database. Thought it might be helpful for some beginners.
from qtfirebase.
@shariatraad no problem - thanks for showing your interest in the project!
People tend to contribute just wrappers for what they need on a per project basis - so that's why some of the larger components are missing features. So we expand only when people need the functionality - and are kind enough to contribute code back :)
from qtfirebase.
(But I still wonder if there is a way to use Qtfirebase Cloud Storage and what functions are unavailable for Real-time Database)
from qtfirebase.
Related Issues (20)
- Using Qtfirebase HOT 13
- Getting Value from Firebase Real-time Database (Qt c++) HOT 1
- QString::sprintf was removed in Qt 5.14.x? HOT 11
- Support for Android AAB (Armv7 & Armv8) HOT 6
- Compatible Firebase SDK versions HOT 1
- Not able to Create QtFirebase object in my main.qml for Android. HOT 2
- Links markdown broken HOT 1
- Bundle of improvements HOT 3
- Provide a CLI to be run qmake HOT 13
- Debugging console HOT 9
- Code signing error HOT 5
- Push notifications while in foreground HOT 9
- Can't compile with QTFIREBASE_CONFIG += analytics messaging for iOS HOT 2
- Qt 6 Support ? HOT 1
- Subscribing to topic nets no result HOT 6
- Linking failed on iOS HOT 10
- Build project with CMakeLists.txt instead of .pro HOT 2
- Subscribe method isn't working on the latest firebase_cpp_sdk (10.0.0) HOT 1
- Qt create how to config my kit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtfirebase.