I need to update an Android app to talk to a Cassandra database. Can anybody point me to an example or libraries to support this?
Normally, you will not do this directly. You should develop an appropriate API (probably a web service, RESTful or otherwise) or mobile web site. Then, your web service/site will sit between the Android app and Cassandra. You can use the server-side language and framework of your choice.
EDIT: A good approach to try is a RESTFUL API with JAX-RS.
Related
I have a web application developed with RoR, and I was wondering if it was plausible to use it as the backend for an Android application that I would develop in Java or Kotlin?
For example, if the web applications authentication is handled with devise, can I get the Android application to send the name and password to my web application and have it return the user as a JSON?
Absolutely you can.
Usually the Android app would call an API rather than a web page. That is you don't exchange HTML like a browser does, just the essential JSON. Lots of things work the same as a web site. For example you can use the same authentication mechanism for the API as for the web-site.
This is a good starting point for RoR to create an API.
https://guides.rubyonrails.org/api_app.html
Here's a starter for Android making a web-service call:
https://developer.android.com/training/volley/simple
That's just a get, which you might use to get a list of something that's publicly available. It's probably worth understanding the other pages just there because with web calls it's really easy to do bad things like lock up the UI thread, so best to use the example patterns and methods.
I'm going to create an app for iOS, Android and Windows Phone that will expose the same features that is currently available from our website which is currently being re-developed, and one of the main feature is a search feature. The website along with all the layers are all built with .net (4.5.2) and sql server and we need to expose all the services to be consumed by the mobile apps. The good thing is that it's up to me to decide how they should be exposed, but I'm not sure what's the best technology/protocol to use. What I've been told it should meet is performance/responsiveness. I thought about exposing the services as a WebAPI layer but I'm not sure if it's the best way to achieve such a requirement.
What would you recommend? Does anybody have bone through a situation like this?
Adding an api layer to an existing web application is pretty easy and I think is perfect for your needs. That way you can essentially wrap your existing functionality with the api.
See this link
Since you are redeveloping the server side, I would take a close look at Azure Mobile Services. If that doesn't work for you, and you need something more custom developed, I would still consider Azure hosting with a Web API layer - Web API is definitely the way to go here as it provides easy way to exchange mobile-friendly JSON with a thin layer over your services.
By the way, for any new .NET development, I would go with ASP.NET vNEXT
Since you are targeting multiple clients, you should expose your business as restful services that return data as JSON and also I would recommend using OData (Open Data Protocol) which is an OASIS standard that defines the best practice for building and consuming RESTFul API.
Also OData provide useful querying techniques for example the following URL will return first 2 persons in the system who have registered at least one trip that costs more than 3000, and only display their first name and last name
http://services.odata.org/v4/TripPinServiceRW/People?$top=2&$select=FirstName,LastName&$filter=Trips/any(d:d/Budget gt 3000)
For more information about OData please check http://www.odata.org/
I have a website and i need to make an app on android and iphone and the app has to communicate with the server,similar to facebook app.Do i need web services like SOAP for this.I read their documentation but how necessary are they and what is their main purpose? Can I do the same without using web services? my website is in codeigniter
If you need to implement web services for your app, I recommend taking a look at CodeIgniter Rest Server. This provides an easy way to implement REST web services, which are lighter weight, easier to work with, and more flexibile than SOAP.
Benefits of using a Web Service:
1 - Usability: You can develop Android and iOS apps, and both of them can use the same Web Service. Other smart phone platforms can also be developed later and use the same Web Service.
2 - Flexibility: For instance, you need to have a mechanism to talk with the database. You can implement the database transaction in your Web Service. (I have experience in using hibernate) You do not have to create a database configuration in every smart phone app. If you decide to change your database, then you just need to modify your database configuration in the Web Service - nothing changes on the client sides.
3 - Security: It is not a good mechanism to connect directly from a Mobile app to your database server. You need to have some kind of Authentication mechanism that can be provided by a Web Service.
Which kind of Web Service is better? I agree with #Justin that REST is a good approach since it is lighter, simpler to implement and more flexible.
SOAP can be a better approach when Security is the most important thing, for instance in certain enterprise scenarios. REST vs. SOAP
Are webservices necessary? Well the correct answer to your question is it depends on the app. Most apps that connect to a server to get some information use web services. However, no you don't need to write your own web services. Increasingly people are using platforms like agigee
http://apigee.com/about/products/usergrid/
So no you would not need to write your own api if you used usergrid, but you might want to if you wanted to keep the data all within your own infrastructure.
I would like to use SOLR to do search on my android app. Is this something that I can do?
If so could you please point me to some code samples out there?
Thanks
Depends. Solr is a quite heavy server application, it's not really suited to run on an Android device.
You'll want to run Solr on a server somewhere and have your Android app connect to Solr via HTTP.
However, Solr is not designed to be used as a public HTTP application (see the Solr security wiki page), so it's generally best to write a small web service that acts as a proxy and at the same time offers a simplified, tailored API for your Android app.
In a particular Android application I know, they use an API endpoint written in
a Python framework which talks JSON. They use both MySQL and Solr for persistence
and some kinds of data is stored exclusively in Solr. And yes, they are using
Solr for it's query capabilities.
Do follow a "Android client <-> API <-> persistence layer" design; dont expose
any databases directly to the android client. As Mauricio Scheffer pointed out,
Solr is not smart enough to secure itself from a delete * from someone who
reverse-engineered your app; a properly designed API can handle illegal requests.
performing a SOLR search on mobile device using this modified class for ANDROID
https://gist.github.com/soltrinox/4b1b85509699c718b5d9
I am trying to develop a system that involves a:
server with a database that will handle the system's logic and manipulate data
an android app that will interact with that server (pull and push data into the server)
a website that will do the same as the android app, but from a website with slightly different data.
What I thought of is to use SQLite with Apache Tomcat installed on the server and deploy a Grails war file on it. That will take care of the 'website' side of the system. But what about the android app? Can it communicate with Tomcat as well?
Tomcat will suit your needs. I would look at hosting options though. Are you hosting your own server, or do you have a hosting provider? Do you have experience hosting a tomcat server etc. Do you have experience with java web applications, or other web frameworks? All of the above, and probably more should lead you to your decision on what type of framework/language to use on the server. This in turn will lead you to your options for hosting, and web-container to use.
Once that is determined all major web frameworks will allow you to publish web-services Rest, Soap, etc. that can be consumed by an android application.
Also, if you are planning on providing a web interface and service at the server level, my guess is you are going to be storing a fair amount of data, I would look into a more robust and scalable database such as mysql or postgres. This post contains some insights into this.
If you have an API that is web accessible, an Android can access it.
Android shouldn't have any problems communicating with Tomcat.
Look at http://grails.org/doc/latest/guide/13.%20Web%20Services.html for more information.
A RESTful web service is most likely what you'll need. Android can consume SOAP web services but it requires more work for less overall functionality.