Same Sencha app for web and mobile - java

Query is : I have a current web application in place to provide me data in a list which is built using java and ui is built using jsp. I want to design a mobile app in Sencha to perform the same task and simultaneously want it in desktop using Sencha/ExtJs.
Now I am confused in following manner :
Do I need to create separate applications for web app and mobile app?
For the web app I need to load a separate set of files whereas for the mobile app it is different. If the application is one then can I do this?
Also, all the java files which I am using for the getting the list data, should be in same code base or separate?
Thanks in advance.

Sencha is a mobile app development framework based on HTML5 and query. So the controls and views are basically designed for mobile screens. But it does not stop you to display the same content on normal desktop browsers. Although what looks great on mobile may not look that good on a browser and vice versa.
Do I need to create separate applications for web app and mobile app?
Not really, everything can be same, views middleware and even backend. If you can design a UI that may look both on mobile and desktop then you are good.
For the web app I need to load a separate set of files whereas for the
mobile app it is different. If the application is one then can I do
this?
As I said above, except UI nothing should be a concern. If you want different look and feel for web and mobile then just create different HTML files for the said purposes. But you can use the same backend logic.
Also, all the java files which I am using for the getting the list
data, should be in same code base or separate?
Generally dynamic web applications fetches the data from backend servers using ajax/http service calls. You may manage the code in a single project or can divide it in logically smaller projects for better management. Maven should be a good choice to manage your projects.

Related

How to create a desktop app for the existing web application?

Well, I've tried to do some researches before creating a question but only a little has been found.
Basically, I have got a Spring-based web application. Apparently, you can navigate through web application using HTTP requests and URLs. If you want to edit a user you do a GET request /users/edit/{id} and a new page appears. Then you make some changes to the user and do a POST request /users/edit/{id} and let's say the main page appears.
So, now I need to create a desktop application which can do the same things.
Do I need to rewrite the whole app to port it on the desktop? Is it possible somehow to do sort of HTTP requests from the desktop app to the server, then get a response and process it? Or perhaps there is a proper way to do it?
I feel like it's a big topic but I only need you to point me in the right direction as I'm lacking experience in creating both desktop and web applications together (I'd say, I have never ported app from web to desktop and vice verse).
Earlier I created a few apps using JavaFX and I want to use it again as my GUI platform for the desktop app.
You can go for a solution like, Electron.
It's a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It uses Chromium and Node.js. You can develop your desktop GUI applications using front and back end components originally developed for your web application.
I'm just pointing you a way. You can look in to this solution and it's also open-source.
If you were about to develop the frontend from scratch I'd recommend you to use something like Ionic Framework where in the latest beta 4 allows you to write once run everywhere (web, PWA, desktop with Electron, and build native build for iOS and Android).
Basically Ionic is an Angular 7 library/superset that allows you to create mobile apps based on a webview. This webview can be embedded and run on any device in a native way.
Even though the same codebase can be run on multiple devices you can customise the look and feel on each platform and access through Cordova, Electron or Capacitor the native device capabilities and hardware.
If you don't want to rewrite the web client, you can use any desktop framework with the preferred language you want. Any modern language/framework will allow you to make HTTP requests against your backend and get the data through your API.
Honestly, nowadays I'd day that JavaFX is not the best option out there and I'd recommend you to go through the web-based approach.
Good luck!

Converting responsive web app to Mobile app?

I have my responsive web application in place which works across all browsers. Now i am planning to work convert it into
mobile application. Did some googling and can think of below ways to come up with mobile app
Approach 1 :-
Can be done with the help of WebView (which actually will work as thin wrapper)
Approach 2 :-
Native App:- . Develop Native app. Now, If I need to develop the native , Can i use existing backend java code for Android/IOS/Windows platform or do i need to make modifications in that ?
If yes will these modification vary per platform i.e. Android/IOS?
For User interface, i believe i need to develop altogether separate views. Is that correct ? If yes will there be separate views for android and IOS ?
If your backend java code is sitting on a server behind some sort of API (REST etc.) then it can be used by both applications.
If you are developing natively for both platforms then you will need separate views. There are however solutions for developing for both platforms using a single codebase see: Xamarin Cordova

How do I connect my Desktop Java Application to an Existing GAE Datastore?

Currently I have a very basic desktop Java application in Eclipse that is meant to add entities to an existing project's datastore on Google App Engine. I have it all setup right now but since I am new to working with Google App Engine, I have no clue on how to get the application to send the Entities into the datastore of my existing project.
I tried looking this up online but most of what I found was for making java web apps. My goal is to have the application running as its own application, not through a browser.
So, what do I have to do to make the application connect to my GAE datastore? Is there some code I need to type, or perhaps some xml file I need to have within the project? I am just using the Java Eclipse plugin for Google App Engine.
Thanks for the help!
Based on the language of your question, I think you really need a big-picture sort of answer, rather than any specific code. Therefore:
You have a desktop application. This runs on some desktop computer.
You have a Google App Engine application with its data store. This runs in Google's data centers.
These are not the same computer. Therefore, they must communicate over the network in some fashion — that is the missing piece you're looking for.
Since GAE is designed around doing web applications, I recommend you think of this as a “web service” situation — that is, your desktop application makes HTTP requests to your GAE application. (The situation is simplified over the general case because you are writing both the client and the server.)
I recommend you read about designing simple web services and do whatever seems to fit your application.
One important warning: Unless your GAE application only ever has one user, you must not simply write a bridge that gives access to the data store over HTTP, because then anyone can make arbitrary changes to other people's data. As it is said for multiplayer game design: don't trust the client — that is, only accept network requests that make sense according to the rules of your application, and do not expect the client to enforce those rules. This is because anyone can make requests to your GAE application using something other than your desktop application, so you must assume you could receive arbitrary requests. This is the fundamental nature of the Internet.
For example, in the simple case of a multi-user application whose users do not interact with each other using the application, this means that every request that, say, updates a record, should only update a record which belongs to the logged-in user, not one of any other user.
For anyone that gets this problem in the future, I got an answer to it. I just tried experimenting around with the project settings and found it. So as it turns out, after you have installed the GAE Eclipse Plugin, you can just right click your project folder in the Package Explorer, go the Google sub menu, then click on App Engine Settings... .
From there, you need to check the Use Google App Engine checkbox, then in the deployment section, just fill in your project's Application ID. Your project's application ID can be found under the Application Settings tab of your project's online Google app engine dashboard. It is listed there as your Application Identifier.
Turns out that for me, I will need to find a different solution as you cannot integrate GAE with a desktop application that uses the Java Swing library. Bummer :/

Web application and mobile application

I want to ask if im using ruby on rails for my web application, what language should I make mobile version(or custom mobile version) of the accordingly my web application?? I need to use JRuby or ?? use Java instead? what is the suggestion that can be combine this two that work together?
Assuming you want to use the classical "HTML mobile web app", the answer is this:
You should ship HTML-only to the users. All communication between the mobile app and the servers should be via an API (JSON is a decent choice for the API protocol, and it's easy to implement in Rails).
You can create the HTML in any way you please - e.g. by compiling .erb/.haml templates in rails.
But on the finished app, you should optimally only have index.html, styles.css and scripts.js.
You can ship an html web app via PhoneGap

Desktop & mobile web application with offline handling

I am evaluating different approaches to building a web based application which handles offline disconnection gracefully. The intention is to create a desktop/tablet UI and a separate mobile UI for the app, backend functionality would be implemented in Java. In principle, the components are mostly there; HTML5 offline seems to have wide support and works well while Web SQL has enough support (Chrome, Opera, iPhone & Android) that we could work with it for offline storage.
As regards creating the UI, it would be nice to use some of the nice JSF libraries out there (Primefaces looks quite nice for example although I've never used it in production). So far, I can't think of any way (and I can't see anything mentioned) of using either HTML5 offline or web SQL in a JSF app. Has this been tried? Is there any methodology/framework that might help here?
I'm also not averse to using client side frameworks. I was very impressed by Dojo for example but then found that it didn't render well on Android with webkit so that ruled it out of use for the tablet scenario. I can probably make jQuery work but I find it to be very fragmented (for example, getting an accordion to handle resizing inside a layout frame just put me off). Finally, I looked at GWT; I wasn't keen on the complexity of getting offline to work and the support for web sql seemed to be a work in progress (no slight intended to the developers, it just seemed to be at an early stage).
So, given the requirement for a web app that runs on desktop/tablet (android) and also on mobile (Android & iPhone) and which handles offline, how would you approach things?
Thanks,
Phil

Categories

Resources