Android application Implement daily updates - java

I’m hoping this question hasn’t been asked before or that it isn’t too basic, but if it has please let me know and I will delete this question!
I have experience programming in Java but I am fairly new to programming for Android Applications (specifically on Eclipse). I’m trying to help a friend out with his business (which will inadvertently be my first Android app!). All that he wants me to do is develop an application where there will be a daily update with an inspirational image and quote. I’m sure it’s something that is extremely simple, but I’m unsure on how to provide continual updates to an application. Would I put it on a server? Can I upload it to some website (Google Drive, image sharing website, etc.) and somehow tell the app to continually grab the newest one? And then save old images and text onto the phone so they can access it anytime in the future?
If you could point me to source code that I could manipulate that would excellent! I learn best when I can alter existing syntax to see effects. I appreciate the help and hope to hear from you soon!
Would you suggest this to be a good example for me to look off of: http://developer.android.com/samples/BasicSyncAdapter/index.html

This isn't an update to the application itself, just sending new content to it. A trivial REST service calling to an HTTP server can send the information. The Spring Android RestTemplate or other similar client-side libraries make consuming REST services easy, and Spring MVC, Jersey, and dozens of other frameworks for Java and other languages can implement the entire server side of this in a few classes.

Related

Is it possible to use more than one framework at the backend(Spring boot + Django)?

tl;dr: Is Spring + Django back-end possible?
When I was new to industry and was still working my way around the office, I got interested in Django and created a very small, basic-level application using the framework. When I got to meet my team after a few weeks, they said to go for Spring framework. After spending half a year on the framework and the main proj, I finally started to get time to start working off-hours. But, I don't want to lose both the skills - My teammate(when we were still in office ;) ) once told me that they worked on a project that started with python code, and then later added features using Java. And I am unable to find any helpful google searches(mostly showing Spring vs Django).
How should I go about it? Is it too much to ask for? Is it worthwhile? Will I learn some new concepts of application architecture a noob like me would have missed. Please provide me with some insight.
Are there resources(docs) I can go through?
P.S. I'm not a diehard fan of either of the frameworks right now, just another coder testing waters.
You can't write java in python.
You can extend Python with C/C++ which is quite common: Extending Python with C or C++
And about the part that they told that they added features with java:
It's common to create different parts of a project using different languages and tools. Microservice architecture is a common architecture for these kinds of use cases. You basically code different parts of the project in a language you want and then you connect all the parts using different methods like REST APIs, gRPC and etc.
Imagine you are creating a website like youtube that lets others upload videos. There is a form that users upload their files and you store them in your storage and then you have to encode the video file for different qualities. You can code the form handler using Python and Django to store the files in your storage. Then you can code another service using java that handles the encoding part which is a heavy process. When an upload is completed, you send the file or file path to your java service using an internal REST API and tell the service to start encoding the video and notify the Django service and then the Django service will publish the video on the feed that can itself be written in another language.
I would say go for 1 framework and stick with it. For example Django if you want to code in python, and spring if you want to code in java. Learning both frameworks however brings a lot of value, because you can compare their benefits (eg. spring forces you to write clean code, django has build-in and simpler database management)
I like Django's build-in tooling a lot, you only need to know python for it to work. Spring requires a bit more knowledge of eg. hibernate for database management. However I predict Django will outgrow spring at some point, because of cloud valuing fast iteration over code and quick startup time (auto-scaling apps) over large overhead apps and long boot times. Hoever, if you like java, I can recommend JHipster for java/spring webapp development to get up to speed very fast and learning the ways of REST CRUD api fast.
To combine 2 programs: write your main logic in one app, and write a small service in the second language, making sure its independent of the first app (no back and forth communication and complicated logic, but simple independent request/response, as if the main app was never there). Add a REST api to the second app and use eg. http requests to communicate.
What's possible in terms of combining languages:
connect different applications with each other: by letting them communicate through their APIs. For example a python api developed with flask or django can send requests to a java api developed with spring, as long as they have a way to communicate (eg over http, or via some queue like rabbitmq)
connect a webapp to 2 different backends: by using a shared authentication system: For example a keycloak authentication server to handle tokens, that your backend applications know about.
What's not possible (and also not preferable):
combining java with python code in the same program: there are some hacky ways to get it to work, but its asking for trouble and not readable.

AppEngine and Android (REST)

i want my android app to communicate with google app engine, to be precise I want to be able to "use" appengine as a rest server. I want on the client side the get, set, update and delete methods, and on appengine i want to be able to handle those, and manage a database saved on google servers.
I don't think I'm asking to much, but online I cannot find a guide that explains how to do that in a clear way, some of you can help me? I know nothing about network and stuff, so be clear^^
If this isn't clear enough - Really can't do much.
https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial
Below links provides even easier way to accomplish appengine implementation.
http://rominirani.com/2014/01/10/google-cloud-endpoints-tutorial-part-1/

How do I make a simple web app with log-in?

I have been doing android programming for a while now but only as a hobby. I know the basics of java, and can say I have a solid understanding of PHP and MySQL (I once followed a tutorial that showed how to create a very basic content management system). I've been wanting to expand my knowledge beyond the simple android apps I've made and recently had an idea for an android app. In this app, the user would create a Username and password the first time it is ran. From then, the user can fill out a form. From what i know so far, the valuesof this form can be stored in a MySQL database. So basically every user needs to have their own set of variables stored (which are not a lot). As I been looking around, i think there are many ways to create a web app, and there are different frameworks for doing so. I read I can create a web app with log-in, using ASP.NET. Can this be done using java? I just need some general guidance. I want to make the web app standalone, and then focus on creating an app for android that uses it.
I think good platform for your kind of case is to use Google App Engine (GAE). It provides platform to do your web-service with Java (or python if you prefer). It is also free for low amounts of traffic (like your service) and they have really good tools to manage the site (check the database entries, usage statistics, etc.).
Google has written a good set of tutorials to build webservice with Java in GAE:
http://googcloudlabs.appspot.com/
AppEngine documentation main page:
http://code.google.com/intl/fi-FI/appengine/
Signup here:
https://appengine.google.com/
I think you may want to look at JavaServer Pages.

Multiple Frontends - Java Backend

I just started working on a project which will about making a big website.
With big i mean:
Webshop
Forum
Normal Website (Information pages etc..)
At first i just wanted to pick a decent open-source webshop and just built my site around it.
But then i started thinking about how to expand etc.
I started to think how i would like this website to be acces from a mobile phone. Not just with a browser but with an App. (I have decent experience in making apps for Android & Iphone). So the real question is:
Would it be smart to make the "Core" of my whole website in Java and use services to acces it and thus allowing different frontends to use the same "Core". Like:
- PHP for browser frontend
- Java (android) for the android App
- Objective C for the IPhone App.
And let them all just communication to the "Core" through REST (Json).
What will be the advantages / disadvantages with this approach and will there be a significant delay in rendering eg. a webpage (http request to php, then php making calls to java server (different physical server) then accessing the database and then returning it all, so php can format it to HTML).
Hope hearing some answers or suggestions!
I would skip the Java layer and make the "core" PHP. There is a wealth of tools and frameworks (like Zend FW) for building thoses components in PHP. Design your application around a REST interface and allow your mobile apps to use REST.
Better yet, use Rails. It's so easy to design and set up a REST interface.
I think your solution is “smart”. The only changes I suggest are:
Use the same platform to build both the "core" and the "browser frontend." This way you will have more productivity.
Keep the "core" and "browser" frontend on the same server, if possible in the same process. Unless you have a reason do it differently. This will reduce problems with performance, latency and so on.
If you're already familiar with Java I would suggest you look at something like GWT (or GWT + third-party libraries like Ext GWT or Smart GWT) for your front-end. I don't see the point in picking another language for the front-end unless you really want to learn something else (e.g. PHP as you suggest in your question).
I think the rest of your approach is sound (i.e. Java on the backend, providing RESTful services, etc.)

Suggestion : Java server implementation for web application

I know this question might be repeated many times but would really appreciate any suggestions. I am working on developing a web application in java (server side). The client is developed in javascript and html5 (another guy) and i want to make the developement independent. I have been using java for quite long but have no experience in web development. After endlessly going thorugh many forums and articles i am so confused.
The web app is pretty simple one with options for user to login and upload some data and access those later.
I started with basic sevlets and JDBC APIs. The web application is not very complex one
Currently i have servlets for each resource to handle post and get call on them.
The suggestion i am looking for is do i need to use some framework to make it better. There are so many like springs, playframework, wicket etc.
Any link to sample web applications developed just usin servlets apis will also do a great deal to me
Thanks in advance for the suggestions
I don't think you need any framework. As you said your app was pretty simple one. A java Framework could make a complex app organized. But would make a simple app complex.
However, if in the future, you want to extend your app further more. you might need a framework. The most famous web frameworks in java are SSH(spring, struts, hibernate), you can find a lot of materials easily, so I won't dive into the detail here. SSH frameworks are not easy, avoid using them if you app is not complex enough.

Categories