I creating a client on Android to interface with a web-service I would like to create using django. I was was wondering if anyone knows of any good projects or examples to make this easier. I recall a great django api module, but I have been unable to find it again (I will keep looking). On the Android side, I could use any advice (json vs xml, ...etc)
I have a similar project and use django-piston on the server side. You can export to many formats (XML, Json, etc) but I prefer Json.
On the client side I use Sencha Touch to create the interface in HTML5, so it is platform independent. We deploy on Android and iOS. Sencha also makes it very easy to consume Json and even store the data offline.
Django Piston works well for creating an API. I used it to create an Android interface recently and it seemed to do the trick. It supports exporting data in XML, YAML, JSON, etc, and you can create your own output formats. You can get it to work with oauth and basic http authentication.
Anyway, might be worth a look.
Related
How to send user text for processing to python script running on a local server and get JSON object back and display that in our app.
This question is not about android studio. If I were you, I would look to python web frameworks which can help you to create a REST API. I usually use Django for big and complex projects, Flask for simple http, Tornado for websockets. In your situation I'd rather use Flask with Mongo no-sql database.
You can also use something like Ngrok to share your local api through the internet.
Here is the tutorial about flask, there are many of them in google, you can choose any.
https://medium.com/python-pandemonium/build-simple-restful-api-with-python-and-flask-part-1-fae9ff66a706
If you have big project with complex backend, my advice will be to use Django and Django REST Framework, there is a lot of information about them in official docs, and also there are good courses on Udemy by Justin Mitchell.
Just follow some flask tutorials and it will be simple to implement what you want
I'm currently developing an android application. My application allows users to choose a picture from a gallery, add a comment and send it to the server. The server then saves it in database.
Currently I'm using HttpUrlConnection at client side and Dynamic Web Project with a servlet to process on server (I'm using eclipse with Apache Tomcat)
So the questions are:
Is it a proper use of this technology to develop my app. (does it violate any rules? Sorry I'm a newbie)
Does this technology affect anything if i want to expand my app?
Are there any better technologies to use in this situation and is it worth to use it?
No I think it is a better way to develop this. I have also develop a chat based app usign the same technologies.
It doesn't violate any rules. There are many apps in the market usign the same technologies.
Q-3.Are there any better technologies to use in this situation and is it worth to use it?
You can also use php or any other server side scripting language to do the same.
Because when you want to host your java app you may find difficulty for java hosting but for php and asp you can easily find hosting services.
I answer in order:
1- the client is different, the client is recomended create an android application.
2-You need have clear this: Android is an application, the server has to attend petition from android. The conection could be using webservices, API rest, or others ways.
3-Android need Java to be native, in the server side you can use, Ruby, PHP, Java, Python or any server programming languaje side. Is your choice.
I know this is a bit off topic, but I really needed some help regarding this.
I am new to Python. I'm trying to build my next project (a dictionary web app which will have both iOS and android app as well) for myself in Python. I've done some research and listed out some promising frameworks.
django
pylons (pyramid + repoze.bfg)
tornado
CherryPy
pyjamas
flask
web.py
etc
But while django is great, it was originally built for newspaper like sites project building. Im stuck with choice making for dictionary like web application which will have to provide RESTful web service api for mobile request handling.
So anyone can you please help in pointing out which framework is the best choice for this type of web app. I think I should go with django. Or should I go with native python coding? Any suggestions will be great.
Django's strength is in it's ORM, huge documentation, and the thousands of reusable applications. The problem with those reusable apps is that the majority is written following Django's MVC design, and as you need a web service, and not a website or web application, most of those apps will be almost useless for you.
On the other hand, there is Django-REST-Framework, extending Django itself, which is pretty good, and it's declarative API feels as if it was part of Django itself. For simple cases just a couple lines of code could produce you a complete CRUD API following REST conventions, generating beautiful URLs, out-of-the box support for multiple authentication mechanisms, etc. but it could be an overkill to pick Django just because of that, especially if you do not wish to use it's ORM.
Flask on the other hand is pretty lightweight, and it's not an MVC-only framework, so in combination with Flask-RESTful, I think it would be an ideal tool for writing REST services.
So a conclusion would be that Django provides the best out-of-the-box experience, but Flask's simplicity and size is too compelling to ignore it.
Go with Django, ignore its entire templating system(used to generate web pages) and use Django-Tastypie for REST service. Easy to learn and set-up is instant.
I want to built a mobile application using Phonegap that will communicate with the restful web services and parse the json data.There are two ways two do it:
Calling restful web services using http connection in Java and connecting the Java code to JavaScript file by making our own plug-in in cordova.
2.Making ajax calls to communicate with rest services.
Which one is better considering the needs below:
1.It can call https web service,since for https in android we need to include certificates,create bks file for that which includes lot of mess.
2.It should be able to receive and parse the json data and render it to the html page.
3.We need to built this app for primarily android OS but if we can built it for ios,windows etc. It would be better.
Please tell me if i am using right tool,if sencha touch is easier to perform these tasks?
I would suggest that you use AJAX because it completely fits all your needs, and you gain to use the same code for future use if you'll ever decide to build for more platforms.
moreover, why make things complicated? you already writing your app using javascript, so don't mix it with native code when its unnecessary.
The fact that you choose PhoneGap, it is an indication that you are wanting to re-use your HTML/JS/CSS expertise as much as possible. Say if you choose jQuery Mobile (or any other framework) for your project, jquery provides ajax for your needs already and there is no reason to go down to the JAVA layer.
That said, the right approach should be using the ajax mechanism provided by your javascript framework. This is your option-2 and you won't need to build the raw ajax utilizes. Like if you go with jQuery/jQueryMobile + Backbone + backbone.marionette (we happen to use them in phoneGap app), there are a lot of add-ons out there to help. Like in this example, it is actually part of the phoneGap app under 'www' directory.
Also the communication to the webservice is your least concern if you have all the tools. Making suggestion on what tools to use is not allowed by Stackoverflow:-)
I am building a web service for my ASP.NET MVC 3 website. Ideally I would like all clients (my web pages, iphone application, android application, windows phone 7 application, etc.) to use the same service layer to load and save data.
I am new to mobile development and was wondering if there is a preferred mechanism - SOAP/JSON/etc - to use a heterogeneous mobile device setup. Specifically I'm wondering if Android and iOS have better libraries/support for one protocol over another or if the main mobile platforms have strong support for all protocols. I am also wondering if all is even when it comes to securing said services.
Any advice would be much appreciated
Thanks
JP
I would suggest a REST(ful) service with JSON.
Both Android and iOS have libraries that support parsing XML and JSON, however the JSON libraries are a bit easier to use and are a little bit faster.
With a little more effort you could allow your service to provide/consume both XML and JSON.
It would be preferable to avoid SOAP as it is more verbose and not as suitable for the more bandwidth/battery sensitive mobile devices.
This would be a great opportunity for you to try out WCF Data services, together with Entity Framework. You can build it very fast, and it exposes your information model using the OData international standard in both XML and JSON flavor. The interface is accessible throught REST. No problems interacting with any front-end technology, fat, web or mobile clients.
AND, you have all the benefits of re-using your C# .NET knowledge, visual studio and created assemblies to also make more tighter integration with Windows applications if you need to. It certainly did the trick for me!
So:
Create your application model using Entity Framework. Either database first if you already have a physical datamodel, or model first is you are starting from scratch.
Expose the created information model using WCF dataservices (5 lines of code)
You can find a walkthrough at: http://msdn.microsoft.com/en-us/magazine/ee336128.aspx
Happy coding!
I have almost same situation and what am I doing is, I am making WCFrest services for android and iphone.
In terms of the security, I am using role based membership provider. So i have created a user for the mobile clients with the role of 'Mobile clients' and give the user id (guid) as an 'api key' to the android and iphone developer.
The iphone and android developer has to send the 'api key' in the header of the request.
so before executing any method in my wcf, i am checking the api key and also checking if the request is from an android or iphone device.
I hope this will help you a little to plan your development..:)
Try using ksoap2 and have your WCF services use the basicHTTP binding.
If you have only primitive types as parameters, this should very easy. With some work you can also use it for more complex types.