I've tried to understand how to fetch data from joomla database with android app but i didn't found what i was looking for.
In the past i've used Joomla api to use joomla database with php custom pages.
Are there some API to use with android? or do i have to write some webservice and use them to make android and joomla DB interact? if this is the only way i have to follow, could you explain me what i have to do or where i could find a good guide to study how to write a good webservice to interact with joomla and how to read it ?
Thanks for the help!!
You need to write a web service that exposes the Joomla data through an API. You need two things
Joomla server/service which would probably need some way of Authenticating the user which could be oAuth or preshared secret
Android client that will connect to the service, authenticate and consume the API and the data
You can check this library which allows you to build REST API on top of Joomla: https://github.com/techjoomla/com_api
Also if you don't need the Joomla functionality but just the data from the database you don't need to plugin your API in Joomla structure itself. Build a standalone REST API/service that will allow your Android app to connect directly without interfering with the Joomla website processes. Thus if you need to do some optimisations to the API or Joomla (e.g. upgrade) you don't need to take both down as they'll be loosely coupled.
For building a RESTful API with oAuth authentication you can go down many routes. One option would be using Laravel and oAuth server and a simple API that will plug in your database and generate JSON output.
Laravel - http://laravel.com/
oAuth Server
https://github.com/lucadegasperi/oauth2-server-laravel
https://github.com/thomaswelton/laravel-oauth
REST API
https://github.com/dingo/api
pull those libraries together and you have a working service
On the Android side you have to build the client authentication and JSON parser to map it to your model classes:
oAuth Client
https://github.com/wuman/android-oauth-client
https://code.google.com/p/google-oauth-java-client/wiki/Setup
http://nilvec.com/implementing-client-side-oauth-on-android.html
JSON parser - http://code.google.com/p/google-gson/
Related
I need to build a Native Android Application for a Website that I have successfully developed. How do I go about this without using the webView. Someone talked about REST API But I don't just know how to go about it.
Although I have the Application in webView Version already but it is just still as the normal website mobile view. No Interactivity.
Your solution is REST API. Here is a good example.
How to create REST API for Android app using PHP, Slim and MySQL
Basically schema should looks like backend(all your data) - Rest Api (you must provide interface to your backend data with CRUD operation like PUT-DELETE-UPDATE-RETREIVE) - users for your Rest Api (mobile apps that would call this api to use data from backend)
For backend look at this tutorial to start https://www.youtube.com/watch?v=xkKcdK1u95s&list=PLqq-6Pq4lTTZh5U8RbdXq0WaYvZBz2rbn
For android app you should use Retrofit2 to facilitate RestApi calls.
Unfortunately I haven't any tried and tested code for this, simply because I think there may be various ways to do this, but I am simply looking advice on which is best, as security and authentication is not my strong point.
I wish to have initially 2 clients - an android app and a grails based web client, both hitting grails RESTful web services. I have REST resources currently returning some data from the domain when using the web client, next step is to get the same data back into the android app. At the same time I want to integrate some user authentication so that the user must be logged in in order to receive back this JSON data from the REST layer.
In the past I have used Apache Shiro when creating a grails app when only using the grails web based client, is it possible to do the same with an android ap as the client?
In my Grails project with web/android front-ends I'm using for android auth a slightly extended version of SPRING_SECURITY_REMEMBER_ME token (yes, I'm using spring-security-core++ plugin). This fits well in the application, is an easy to implement, tried and tested solution.
I've built a Rails 4 web application with PostgreSQL database and hosted it on Heroku. The future plan for that database is to also be used by one Android application.
I am not completely sure how can I accomplish that. Do I need to build another REST application and host it on Heroku and somehow connect to the same database or there is another way?
How to connect with Android application to that database which is used by the web site? I know I can't connect directly.
Thank you for your guidance.
You don't need another app - just build an API for current one and then you can communicate from Android app to your web application (web app will connect to db and return data).
Have a look at Twitter API as example - you can access different resources and manage them via Twitter API
https://dev.twitter.com/docs/api/1.1
You can build something similar - create rails controllers that access your database and respond with structure you want - preferably JSON format of your models (or something custom if you need)
From Android app you can send request to your API and parse JSON responses - then process data your own way on Android app.
Don't forget about authentication between your Android app and web application - let only your Android app to use it.
I encourage you to browse internet for best practices 'How to create an API' :)
I'm creating my first android app. My app works in the following way:
User log into the app.
The login details is on an online server which is SQL Server 2008 R2
The server will return data to the app and the data the data will be stored on the app's database.
The problem I am facing is how should i connect to Sql server database. I researched on this topic and found out that I need to use some service. Can someone suggest as to what service should i use? A normal .NET web service, WCF service or Java Service.
I also need to know how to consume this service in my app.
Softwares I have with me:
Visual Studio 2008
SQL Server 2008 R2.
Android Development Kit & Eclipse
SQLite
Please help me.
I highly recommend the Asp.Net Web API for this:
"ASP.NET includes ASP.NET Web API for creating rich REST-ful Web Services that return JSON, XML, or any kind of content the web supports! ASP.NET Web APIs can provide data services to mobile apps like Windows Phones, iPhones, Android and more. ASP.NET Web APIs can be used in any ASP.NET Web Application, including ASP.NET MVC, Web Forms, or Web Pages – it's all One ASP.NET."
http://www.asp.net/web-api
Just to get you the general overview here;
You do not connect your (Android) app directly to the remote SQL database/server. Android, nor any other mobile platform, provides a steady and reliable interface for doing so.
Secondly, what you want to make indeed is a (REST) web-service.
As long as your needs are simple (passing along a bit of simple data between your app and your database) this means nothing more then having some web language take up some GET or POST variables and putting them in the database for you. And the same the other way around.
You can do this in any (web)language. The choice for language might be most influenced by the server you want to run in on, and what languages it already supports.
Given the lack of information on the web ask a question:
I'm going to create an application in Android, the use of a database application
Rails. For this I need a manual session. So if anyone has a ready
example / tutorial showing communication android-rails using
session, or is able to share your knowledge on this subject?
Rails 3 resources use RESTful APIs by default. Define a supported format (XML or JSON) in your Rails app and just make REST calls from your Android client.
There should be no need for you to be trying to manipulate the database directly from your Android client. That will skip all the validations and before_saves you have set up in your Rails app.
Use REST and you should be fine.