Kong Kong - 4 months ago 22
Android Question

Native Android app with Drupal backend and Login

I need to create a native Android app, this app will use Drupal as a back end.

The app must be native. All the back end functionality, will be taken care of in Drupal, even the login credentials. I will use JSON to get the data from Drupal

I have a few questions on what is possible.

Login credentials are stored in Drupal DB. How can i login to Android with these credentials? Can i use JSON and what about the password? The password need to be encrypted.

Is there something like a password protected JSON url? I don't want anyone not authorized to see the JSON url.

Also the UI of the app will change, depending on the role of the person logged in. Example: Therapist and patient. Can this be accomplished easily? Do you have any advice on how this might be done.

If you have any advice or suggestion please let me know.

I am new to Android and not an experienced programmer.

Thanks in advance

Answer

First, I don't see why Drupal should log in to Android?!? It suppose to be other way, Drupal is the server.

Second, if you are just going to pull JSON data do you really need to login? It would be much easier for JSON file path to accept some extra password parameter. PHP script will "catch" request from Android, check for that parameter and if password is ok provide JSON feed and if not just return some error or nothing at all. Something like:

www.your-site.com/myfeed.json?password=gjkl3#$fjl3556

And there will be some php script which will first just check for password parameter and if it's not ok just quit. If it's ok it can get data, encode to json, shoot out json header and json data.

Comments