问题
In my Android app, I am using Firebase as a database. I want to add some search capability and after my research I have found that Algolia is proper for me.
Algolia's Firebase tutorial explains how to integrate my existing Firebase database with Algolia. In this tutorial, they provide some Node.js code (which I am not familiar with). In the first gathering of data, I just copied the integration code, did the necessary changes and ran it on Windows terminal: the data is now imported from Firebase to Algolia.
But there are some other necessary specifications like updating, removing data. They also provide some js codes for this purpose, but I really dont know how to attach this listeners in my android app with this js code.
Can anybody give me an idea how it is properly done?
回答1:
From the phrasing of your question, I'm not sure if you want to learn how to search your Firebase data in Algolia from an Android app or if you are trying to index/update/delete your Firebase data from an Android app.
Searching your data from an Android app
If you want to search your data from an Android app, there are a few guides to get you started.
- You should check the Android Instant Search Result Page Guide, which guides you through the implementation of a complete search result page from the data model to building the UI:
- You can also check the Android API Client Search Documentation, which contains concrete examples of how you can search your data as well as general advice on using Algolia efficiently:
If you wanted to index/update/delete your data in Android
If you were trying to write to your data from an Android App, this is not a good idea: an Android app is easy to decompile or intercept to read secrets like your Algolia API Key, which is why in an Android application or in any front-end implementation of Algolia you should only use your Search-only API Key to ensure nobody could mess with your data inside Algolia.
I advise you to read Algolia's Security Best Practices to learn more on security with Algolia (specifically the entries Secure your Admin API Key and API Key security), and to have a look at Algolia's Guide on API Key Security for a guide on using Algolia's Secured API Keys feature.
来源:https://stackoverflow.com/questions/39331107/algolia-firebase-and-android-integration