Wish Cloud Firestore

Do You need Firestore in your Project?


  • Total voters
    29

Jon Eskdale

Member
Licensed User
Longtime User
Officially it is still in Beta - but Google products are in Beta for years - Just remember how many years Gmail was in Beta but everyone was using it.
However, it is Google's recommended solution for new projects where its features include all the necessary features. And they do say it is replacing the Firebase database.
 

Mashiane

Expert
Licensed User
Longtime User
@Jon Eskdale I hear you. I think even the team here that was working with the elusive FireBase library indicated that working on FireStore can only only happen once the beta has been done and a release is made. I took a chance to look at the FireBase in javascript and will version this for ABM at some stage. One could implement this for a webview based app though. I will also explore FireStore in Javascript once a release is done also.

I see someone managed to get a basic firebase database working. All good. Lets hope that someone can FireStore too.
 

DonManfred

Expert
Licensed User
Longtime User
And it also works if one find out all the needed dependencies and that one need to replace (add two lines) to the
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)

B4X:
#MultiDex: true
#AdditionalJar: com.google.android.gms:play-services-auth
#AdditionalJar: com.google.android.gms:play-services-base
#AdditionalJar: constraintlayout-1.1.0.aar
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-auth
#AdditionalJar: com.google.firebase:firebase-database
#AdditionalJar: com.google.firebase:firebase-core
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-firestore
#AdditionalJar: grpc-core-1.20.0.jar
#AdditionalJar: grpc-protobuf-1.20.0.jar
#AdditionalJar: grpc-okhttp-1.20.0.jar
#AdditionalJar: grpc-android-1.20.0.aar
#AdditionalJar: opencensus-api-0.20.0.jar
#AdditionalJar: grpc-stub-1.20.0.jar
#AdditionalJar: grpc-protobuf-lite-1.20.0.jar
#AdditionalJar: opencensus-contrib-http-util-0.20.0.jar
#AdditionalJar: opencensus-contrib-grpc-metrics-0.20.0.jar
#AdditionalJar: grpc-context-1.20.0.jar

'#AdditionalJar: com.google.firebase:protolite-well-known-types
#AdditionalJar: glide-3.8.0
#AdditionalJar: guava-27.0.1-android
#AdditionalJar: materialprogressbar.aar
#AdditionalJar: com.google.gms:google-services
#ExcludeClasses: com.google.guava:guava-jdk5

*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Auth_SignedIn. precheck
Auth_SignedIn. check false
Auth_SignedIn. line before fs.Initialize("Firestore",True)
FirebaseFirestore.setLoggingEnabled(logging)
FirebaseFirestore.getInstance();
after FirebaseFirestore.getInstance();
Setting query to get all Drivers
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
onAuthStateChanged: com.google.firebase.auth.internal.zzi@a230915
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (firestore_snapshot)
sending message to waiting queue (collection_snapshot)
running waiting messages (2)
Firestore_Snapshot(com.google.firebase.firestore.QuerySnapshot@b9ee701)
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=DonManfred, category=Private, userName=DonManfred}
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}
Collection_Snapshot(com.google.firebase.firestore.QuerySnapshot@ad23f9f3)
DocumentNo: #0: KP4jH5pjjD8ESXTzl7ge
(MyMap) {price=1.25, Driver=com.google.firebase.firestore.DocumentReference@a735855e, category=Taxi, numberPlate=MSY1912, Location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, Name=Mannes Headquarter}
Location: 50.833598, 6.4411892
** Activity (main) Resume **
Collection_onEvent(DocumentSnapshot{key=Drivers/u8gkB2lhRRMG5jLW5F6D, metadata=SnapshotMetadata{hasPendingWrites=false, isFromCache=true}, doc=Document{key=Drivers/u8gkB2lhRRMG5jLW5F6D, data=ArraySortedMap{(category=>Private), (city=>Düren), (id=>Mannes), (location=>GeoPoint { latitude=50.833598, longitude=6.4411892 }), (photoUrl=>http://basic4android.de/donmanfred.png), (realName=>Manfred), (userName=>DonManfred)};, version=SnapshotVersion(seconds=1524309854, nanos=504764000), documentState=SYNCED}})
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}
Driver_Snapshot(2,com.google.firebase.firestore.QuerySnapshot@95ae5962)
DocumentNo: #0: ceGC7eI8RM17dP0eSyZZ
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=DonManfred, category=Private, userName=DonManfred}
DocumentNo: #1: u8gkB2lhRRMG5jLW5F6D
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}
Items in global DriversMap=2
ID = ceGC7eI8RM17dP0eSyZZ
Data ={photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=DonManfred, category=Private, userName=DonManfred, DocumentID=ceGC7eI8RM17dP0eSyZZ, Reference=com.google.firebase.firestore.DocumentReference@2e0f88c7}
ID = u8gkB2lhRRMG5jLW5F6D
Data ={photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred, DocumentID=u8gkB2lhRRMG5jLW5F6D, Reference=com.google.firebase.firestore.DocumentReference@a735855e}
Collection_Snapshot(com.google.firebase.firestore.QuerySnapshot@e087e914)
DocumentNo: #0: KP4jH5pjjD8ESXTzl7ge
(MyMap) {price=1.25, Driver=com.google.firebase.firestore.DocumentReference@a735855e, category=Taxi, numberPlate=MSY1912, Location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, Name=Mannes Headquarter}
Location: 50.833598, 6.4411892
Collection_onValue(true,DocumentSnapshot{key=Drivers/u8gkB2lhRRMG5jLW5F6D, metadata=SnapshotMetadata{hasPendingWrites=false, isFromCache=false}, doc=Document{key=Drivers/u8gkB2lhRRMG5jLW5F6D, data=ArraySortedMap{(category=>Private), (city=>Düren), (id=>Mannes), (location=>GeoPoint { latitude=50.833598, longitude=6.4411892 }), (photoUrl=>http://basic4android.de/donmanfred.png), (realName=>Manfred), (userName=>DonManfred)};, version=SnapshotVersion(seconds=1524309854, nanos=504764000), documentState=SYNCED}})
DocumentID: u8gkB2lhRRMG5jLW5F6D
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}
Collection_onEvent(DocumentSnapshot{key=Drivers/u8gkB2lhRRMG5jLW5F6D, metadata=SnapshotMetadata{hasPendingWrites=false, isFromCache=false}, doc=Document{key=Drivers/u8gkB2lhRRMG5jLW5F6D, data=ArraySortedMap{(category=>Private), (city=>Düren), (id=>Mannes), (location=>GeoPoint { latitude=50.833598, longitude=6.4411892 }), (photoUrl=>http://basic4android.de/donmanfred.png), (realName=>Manfred), (userName=>DonManfred)};, version=SnapshotVersion(seconds=1524309854, nanos=504764000), documentState=SYNCED}})
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}
Collection_onValue(true,DocumentSnapshot{key=Drivers/u8gkB2lhRRMG5jLW5F6D, metadata=SnapshotMetadata{hasPendingWrites=false, isFromCache=false}, doc=Document{key=Drivers/u8gkB2lhRRMG5jLW5F6D, data=ArraySortedMap{(category=>Private), (city=>Düren), (id=>Mannes), (location=>GeoPoint { latitude=50.833598, longitude=6.4411892 }), (photoUrl=>http://basic4android.de/donmanfred.png), (realName=>Manfred), (userName=>DonManfred)};, version=SnapshotVersion(seconds=1524309854, nanos=504764000), documentState=SYNCED}})
DocumentID: u8gkB2lhRRMG5jLW5F6D
(MyMap) {photoUrl=http://basic4android.de/donmanfred.png, realName=Manfred, city=Düren, location=GeoPoint { latitude=50.833598, longitude=6.4411892 }, id=Mannes, category=Private, userName=DonManfred}

But basically it works :D
 

Alexander Stolte

Expert
Licensed User
Longtime User
#AdditionalJar: com.google.android.gms:play-services-auth
#AdditionalJar: com.google.android.gms:play-services-base
#AdditionalJar: constraintlayout-1.1.0.aar
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-auth
#AdditionalJar: com.google.firebase:firebase-database
#AdditionalJar: com.google.firebase:firebase-core
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-firestore
#AdditionalJar: grpc-core-1.20.0.jar
#AdditionalJar: grpc-protobuf-1.20.0.jar
#AdditionalJar: grpc-okhttp-1.20.0.jar
#AdditionalJar: grpc-android-1.20.0.aar
#AdditionalJar: opencensus-api-0.20.0.jar
#AdditionalJar: grpc-stub-1.20.0.jar
#AdditionalJar: grpc-protobuf-lite-1.20.0.jar
#AdditionalJar: opencensus-contrib-http-util-0.20.0.jar
#AdditionalJar: opencensus-contrib-grpc-metrics-0.20.0.jar
#AdditionalJar: grpc-context-1.20.0.jar

'#AdditionalJar: com.google.firebase:protolite-well-known-types
#AdditionalJar: glide-3.8.0
#AdditionalJar: guava-27.0.1-android
#AdditionalJar: materialprogressbar.aar
#AdditionalJar: com.google.gms:google-services
#ExcludeClasses: com.google.guava:guava-jdk5
Sorry but WTF,too mutch :rolleyes:
 

DonManfred

Expert
Licensed User
Longtime User
it is possible that maybe one or more of them are not needed. but with my tests in the lasts months i found out that they are needed.
Today i fixed a problem which i encounter long time ago but did not really found a solution. I not setup a testproject using android studio, decompiled this apk and found a difference in the manifest. I extracted the Firebase.b4x_excluded from FirebaseAnalytics.jar, added two lines and put them back to the jar.

Effectively i changed

B4X:
 <service android:name="com.google.firebase.components.ComponentDiscoveryService" >
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

to

B4X:
 <service android:name="com.google.firebase.components.ComponentDiscoveryService" >
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
             android:value="com.google.firebase.components.ComponentRegistrar"/>
</service>
The last meta-data tag is added to include FirebaseFirestore. This is a mandatory and needed step to get anything working with Firestore.
 
Top