How to use Algolia in Android with Firebase content - android

I made an app where anyone can sell a product: you set its details and then I save it in Firebase.
On the client side (Android app) I want to be able to search for products using plain text.
I think the best way is by using Algolia but I really have no idea how to set-it up. Your help will be appreciated!

There are actually two topics in your question: how can one link Algolia to a Firebase database and how can one build an Android app with Algolia. I'll cover both in my answer.
How to link Algolia to Firebase
You will need to use a scripting language to import your existing data into Algolia and to sync the changes when your data is updated. Algolia has a guide to help you do so using Node.js.
You don't need to be experienced with Node.js to do it! Have a look at this question where an Android developer like you with no prior experience of Node.js just followed the guide:
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.
You simply need to:
Copy the code samples from Algolia's Firebase guide
Replace the credentials with yours
Run the scripts from your computer (if you never ran js scripts locally, search for a Node.js beginner's guide like this or this)
Once your data is imported in Algolia, you can move on to step 2:
How to use Algolia in your Android app
For building your search interface with Algolia, the recommended tool is InstantSearch Android. It's a toolbox that provides you plug-and-play components to build your search interface quickly: InstantSearch will handle all the network-related issues, the data-binding, and many other things so you can focus on what's specific to your app.
You can have a look at InstantSearch Android's demo apps which will show you examples what you could build using this tool, like this Media demo:
Algolia also provides an Android API Client for building apps. It lets you interact at a lower level with Algolia: you send the requests, get the results as JSONObject and decide what you want to do with it.
Most projects should use InstantSearch Android as it is built to make your development easier and faster (and it actually uses the Android API Client under the hood!)

Related

firebase integration with android instantapp

I am trying to use firebase's real-time database with android instant app.
Looking at google doc for using the real-time database, I do have bit of idea.
However the example that google provide is base on android app, not the instant one. As you know that there are multiple modules for instant app. base, app, feature(default name suggested by android studio). Should I add firebase packages in each of appGriddle, baseGriddle and appGriddle?
What about the JSON file generated by firebase... where should I place that JSON file? If the app is not instant one, I know that I just need to place it in app..There are multiple modules...
I try to do it with android studio's firebase tool for configuration. However it does not work. I looked up others attempt;changing "implement" to "api"... It does not work either.
Please let me know if you know a way to deal with instant app and firebase's real-time database together
Thank you.
Can you explain more on what you mean by 'Instant' app?
All the docs are available in the firebase website:
https://firebase.google.com/docs/guides/
There are guides for iOS, android, etc.
For a start, have you create your database by logging in the Firebase online console?

How to connect and use google cloud sql for database access?

I know this is a nooby question and I apologise in advance. I'm looking all over but I just can't seem to find any documentation on connecting an Android app built in Android Studio to a Google Cloud SQL Database.
I'm only really doing this to try and find out how it is done because I'm interested in it but I'm very new to Android development. I've connected to a SQL database before from c# but it was only a local one, I've never connected to an online one before and I think the Google Cloud Platform operates a bit differently anyway?
Basically, whenever I try to find documentation for this, it keeps referring back to the Google App Engine, which seems to be a different way to create apps than just writing them in Android Studio (very likely I could be wrong, like I said, I'm very new to Android development).
I've seen that there is documentation for Eclipse with the Google Plugin but can't find anything for Android Studio. Is Android Studio not suited for this type of use?
I've seen that you can create a Google Cloud module for a project in Android Studio but I'm not exactly sure what that entails.
Basically, I would just love a set of very basic steps that I should follow for if I were wanting to write to a Google Cloud SQL DB from an Android app in Android Studio.
Otherwise, any good resources where I could possibly learn more about what I need to do would also be appreciated.
I think my biggest issue currently is that I have exactly 0 backend knowledge and so I'm just not really sure of what is required to set up this connection.
You should not access Cloud SQL directly from your Android (or iOS) or other client because you cannot secure the credentials needed to do so. If you embedded your credentials into your app, someone could extract them and either gain access to your database directly or could cause other trouble for you.
If you are open to other database types and you don't want to explore proxying requests through your own backend, then you should take a look at Cloud Firestore or Firebase Realtime Database. Firebase provides SDKs for Android that allow you to access these securely directly from your app. Firestore will scale better than the Realtime database, but that might not matter for your app.
A similar question and reason for why you shouldn't try to connect directly to Cloud SQL is covered in more depth here.

Android app fetching Joomla website with DB

My client has Joomla website with plugins (Mosets tree and JSE events) that basically lists business an events. He wants an android app developed to fetch these info. Immidiately what came to mind, is I create php scripts that query the Database and I call those scripts from my app. In my app, I display the information collected.
Another idea that occurred to me, is to enable RSS feed and then I read this RSS feed.
Is my approach above the right approach? Is there a different way or standard way when developing apps that fetch information from the Joomla website backend?
Please note the website is already mobile friendly but the requirement is to create an app for part of the website. Any pointers are helpful
Building one or more PHP scripts that query the db and returns the data is definitely the faster and simpler solution.
If you want to build a more robust / compatible solution, you may extend your set of PHP scripts into a full blown REST API application. In that case take a look frameworks like SLIM or SILEX which are very good at this.
There are more complete and elegant solutions but they are probably overkill for your needs.
Edit: why query directly the database
In theory, it seems to be better to NOT access directly the database, and interact with the Mosets Tree component instead; because in that way you will not have to duplicate any logic.
But in my experience, with a very few exceptions, Joomla components are coded so that it's very hard to interact with them programmatically.
I answered a similar question regarding Joomla RESTful APIs here:
REST API for Joomla 3.0
Basically, I ended up developing a solution which meshes the Slim PHP micro-framework with the Joomla Framework / CMS (requires Joomla 3.4.3+).
Why?
Well, the main reason is that while using the Slim framework would be OK as a one-off solution, I realized that one would still need to develop all the accompanying ACL and access security, not to mention the actual CMS that might store and manage all the important data in the first place.
Basically, I did the work so you don't have to. Yes, it's a commercial component (must pay to download) but I think it's WELL worth it for what you end up getting out of it.
It's brand new, so the service routes in the cAPI ("Constant API") Core package are still limited, but those are being built-out over time (all included in the core package of course). The component/plugin/library package is architected to allow for easy integration of add-on plugins which will introduce new service routes to add functionality like RESTful JSON APIs for MySQL, MSSQL, MongoDB, LDAP, etc. I already use an alpha version of the LDAP add-on in a an enterprise environment, so I expect that to be available for purchase/download soon.
The point of all this is that you can use an existing Joomla site to drive mobile apps (with some development for Mosets), while taking advantage of built-in user management and ACL, along with token auth (via cAPI).
Let me know if you have any questions.

Creating Photosharing app on Android

I want to develop android application like Photofeed application as mentioned on Google cloud sample link or like Instagram. For that I need App Engine SDK but i am not getting how i will achieve this functionality. In my app, i want exact functionalities (uploading image, like and comment on that photo) like Photofeed app shown on that link. For that I'll have to use Google Cloud Storage but Photofeed is for Webapp and i want to develop Mobile app. For that i also referred Mobile back-end starter but not getting much idea. Its quite confusing. Please guide me to develop this application. Is it possible to use Photofeed sample java classes in my android application?
Thank you.
You will need to install Google Plugin for Eclipse and make Android Connected App Engine Application. This is a good starting point.
You can make similar app or any app that connects to GAE as backend in 4 steps as follows:
Make your entity classes: You can use JPA, JDO or Objectify to access the Data Store or use its API directly as done in the sample NoSQL classes (The easiest way is Objectify IMO). Or you can use Google Cloud SQL as done in the SQL classes of the sample ( I never used that in a project so I do not know if there is another way beside the API).
Make REST Endpoints: You can use Google Cloud Endpoints to make REST API for your own app. This will allow you to develop Android, iOS and JavaScript clients in unified way. If needed you can secure it using OAuth too.
Generate Client Libraries: If you are using Eclipse, Google Plugin will provide that in the context menu of the App Engine project so you simply right click and click Generate Client Libraries. It can be done using command line too.
Consume the endpoints in the Android app: This is done really simple as explained here.
Note : You will need a Servlet to upload photos to Google Cloud Storage. You can make use of the one in the sample.

Create a Google like instant search in an Android app

I am working on an Android app in which i want to add an instant search feature.
Basically I want to show places name when the user writes its initials in a TextBox.
How can I achieve this?
Building the interface
You can use InstantSearch Android, which is an open-source library to help you easily build instant search experiences on Android using Algolia.
It is available on GitHub and lets you build quickly an instant search UI. See for example the InstantSearch Media application:
You can start with the Getting Started Guide which will take you through the main steps to use the library.
The example applications can give you an idea of what you can build with InstantSearch Android.
Using the data
If you have the places data you want to search in, you can simply index it in Algolia and it will be searchable in your app.
If you don't have the data somewhere, have a look at Algolia Places which provides a free access to a worldwide places database.
Disclaimer: I am the author of InstantSearch Android.

Categories

Resources