Android Layout on Worklight - android-layout

I am beginner with Worklight. I developed an android application using Estimote Android API. Now I want the same application in Worklight. What should I do to get android UI on worklight. I wrote same code on Native folder in Android environment. But I am getting blank display instead of MainActivity layout. How to display android layout on Worklight? Please help me with this issue.

Are you aware of Worklight's client-side abilities? That is, with Worklight you can create either Hybrid apps or Native apps. Make sure to read IBM Worklight's Getting Started training materials.
Hybrid apps are basically a native application shell, containing a web app built using JavaScript, CSS and HTML.
Native apps are just that, fully native Android apps where Worklight provides an API set to work with the Worklight Server and other server-side features.
From your text, it sounds like you have opted to use the Hybrid application model, and in this case it would make perfect sense to me that your native UI code is not displayed out-of-the-box, as that would require altering the default Activity Worklight provides for the Hybrid Android application.
You do not explain what changes you have done
The default activity essentially brings up a Web View into which it loads the client framework as well as display in the index.html that can be found in your Worklight application (your project > your app > common folder > index.html).
So by just adding your code and layout, it does not mean that your app's display will change. This will require you to alter the loading sequence of the application.
You do not explain what changes you have done
In any case, it sounds to me like you need to decide whether to:
Use HTML, CSS and JavaScript to build your application's UI per the Hybrid application model
Create a native app instead, where you will be able to create the UI how you want to, like you say in your question
Learn how to mix & match native and web UI elements together in your Hybrid Worklight application

Related

How can I convert a HTML template into a Node.JS web app

I'm starting out on my Node.JS journey and I discovered a fantastic boilerplate over at https://github.com/azouaoui-med/pro-sidebar-template. I'm unsure though how to turn the static html into a web app. Just wondering how someone with more experience would do this?
Do I take the html and translate it into a PUG template file? I'm guessing to then make the onclick / links actually run some code, i'd need to point them at the routes setup in the web app?
Sorry to ask such inexperienced questions, web apps seem to take a vastly different approach to the desktop apps i'm familiar with programming
I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
thanks
The project you have is using browser-sync which indirectly uses NodeJS to run a local server and host the web application files.
Do I take the HTML and translate it into a PUG template file?
I am not sure about this question unless you specifically want to use server-side rendering I am not sure I would recommend this to start with especially if you plan to later convert this to a desktop application.
[Note* - Assuming you are referencing this library PUGJS in statements above ]
Now For this requirement I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
This will require you to make your data serving layer which is most commonly called backend separate from that of the data viewing layer which is most commonly referred to as front-end. Thus a case for using the same data layer across different types of clients viz. A web application and/or A desktop application ( electron if you choose so )
Step 1 - Define what sort of web application architecture you want to follow or use. This will be based on your project and business requirements. From what information I have so far I would suggest a simple client-server architecture where your frontend or web-application is the client which makes REST API calls to the backend (API Server) and thus produces a meaningful result.
Step 2 - Start with the creation of 2 projects a frontend where your HTML, CSS JS, etc will be and a simple NodeJS script to serve this static web app when deployed on the server. I am going with NodeJS since the context of this question is suggesting the same.
Step 3 - The other project which will only be an API Server or Backend. This server will provide only REST API to the frontend. This server will talk to the database and provide other services like authentication and logging etc. You can use expressJS for this also in the frontend project.
Here is a simplistic representation of the client-server model which you can reference.
Some additional links for you to digest.
What is the difference between a web application and a client/server application?
https://medium.com/codiumclub/web-application-architecture-part-1-guide-to-become-full-stack-developer-cc9526a3519b

Xamarin.Forms or Xamarin.Android/Xamarin.IOS

I am new to Xamarin and not sure if chose Xamarin.Forms to create a application for ios and android platform has a problem or not.
The application has some features below:
The application will be able to running some code in background without launching application by user.
The application can be launched by a href link or a notification.
The application is able to launch a builtin Camera application, and receive picture data from Camera application.
Thanks,
Bo
The features you are mentioning can be done with both. Actually, anything you can do on Xamarin.iOS and Xamarin.Android can be done with Forms. Because Forms is only an abstraction layer for the UI which is installed by a NuGet package.
Now, having that said when to use Forms or when to use iOS/Android? It is mostly about UI. Are you going to do some advanced or platform specific stuff is is easier to implement that with the platform specific project.
If you UI will be the same in both platforms and mostly consists of some lists and input fields, then that is a very good candidate for a Forms project.
Notice how I said it is easier to do in the platform specific projects. Again here, you can do anything in Forms as well by the means of Custom Renderers, it is just a bit harder to do.
Ideally try it out yourself and see what suits you best.
In regard with your need to execute code in the background. This will be tricky and is very dependent on the platform that you're on. You will definitely have to write platform specific code for that for which you can use the DependencyService to abstract it to your shared code.
However like AlancLui mentioned executing code in the background isn't something that is easy to do on mobile. On iOS it is restricted to accessing location data or playing music, but still your app needs to be running (in the background). Android has something called Services for this, which makes it a bit easier.

API for Mobile web app development

I am trying to build a mobile web app using worklight .I checked the IBM website but they have limited documentation on it.I wanted to know is there any inbuilt API provided by IBM in order to develop the mobile web app?
I am specifically looking for API to to control the refresh button and the back button in mobile web browser
Why limited? Where did you look? There is comprehensive user documentation and training modules in the following websites:
IBM Worklight Getting Started training modules
IBM Worklight user documentation: client-side JavaScript API reference
Regardless, there is no such thing as "controlling a browser's Back and Refresh buttons".
These buttons are provided by the mobile browser and are out of scope for whatever is running within.
It would be more beneficial for you to edit the question and explain your specific scenario - what it is that you are actually trying to accomplish.
In Worklight, you have WL.Client.reloadApp, for example, which can be used to refresh the web resources displayed. As for "back button"-like functionality, this can only be determined once you explain what you are trying to accomplish.
Additionally, keep in mind that while Worklight provides some API methods for controlling UI elements, it does so only to a certain degree and only for elements that are most common to all mobile environments (iOS, Android, ... for example, creating a tabbar); when you develop a web app for the Mobile Web environment, you cannot control via the app things like the Refresh button that the mobile browser supplies.
Lastly, you can and probably should opt to 3rd party frameworks such as jQuery Mobile and the like for the UI aspect in your Worklight application.

Web based Oracle Scene Builder analog

I want to provide an ability to create simple java and javafx applications to the users on my website. I've found excellent code editor (Ace) but I don't know how to provide FXML design tool to the Web users.
Is there any options?
ADD I want the users to use this interface builder without any additional requirements like Java 8 or something
How to host SceneBuilder in a web page (requires Java 8):
Build SceneBuilder from it's source.
Package it as a Browser Embedded Application.
Host your packaged application on the Internet and direct web users to its URL.
Other than using a fork of SceneBuilder for your project, I don't know of any other feasible way to provide visual FXML editing capabilities. I would certainly not recommend trying to create from scratch your own FXML visual editor written in either Java or JavaScript.

Mobile app with Node.js backend - What framework to pick for client-side dev?

I'm planning to build a hybrid mobile app,
I have already progressed pretty well with the server-side using Express 3, and PAssport for authentication.
Now I need to make a decision on what framework or library to use for the clinet-side.
I was wondering if I could get some recommendations and perhaps pros and cons of going with frameworks like
Sencha Touch, JQuery Mobile, Phonegap....
and if there is anyother ones that you think it's worth considering please mention them here,
Thanks for any pointers or advice
JQuery Mobile and Sencha Touch are JavaScript libraries that will let you create an HTML5 application that looks like a native application. Cordova/Phonegap lets you wrap your HTML5 app in native code and provides a common JavaScript API that gives you access to native functionality, like taking a picture with the camera or getting the users Contacts. Another benefit of using Cordova is that it creates native applications for you using the same HTML5 app, so you can publish these files to App stores and increase your distribution. With a JQuery/Sencha Touch only app, you can't distribute on app stores because your hybrid app is simply a website (so, I guess it'd only be a mobile app.)
There are hundreds of blog posts comparing different JavaScript frameworks like Sencha vs jQuery vs Dojo, so you should just go off and do some of that reading. Personally I would suggest Dojo as I think it is the most powerful and enterprise ready framework, but it can have a steep learning curve. One thing I like about Dojo though is the build system, you can pick and choose the modules you want so that you don't have to end up including an enormous .js file like JQuery. I have no idea if jQuery can do this, but a lot of user apps I have seen that use Cordova and JQuery end up including all of jQuery and then jQuery mobile.
If you want to access native device features and/or package the web app as a native app and distribute it on the stores, you should use one of those JavaScript frameworks in combinations with Cordova. (Cordova is the new name for PhoneGap.) Phonegap/Cordova is not really used to build mobile web apps, it's used to extend the capabilities of mobile web apps and allow them to access native device functionality in a completely cross platform way.
Ionic is a new framework available for making hybrid apps that I am liking a lot so far. The framework is built with Sass and AngularJS on top of PhoneGap. Ionic just handles the front end so you still build your app with PhoneGap. I found that since it uses AngularJS your javascript code ends up being a lot cleaner and you will save development time making your app slick compared to what you would have to write with jQuery. It also has some beautiful UI elements. The ionic team has done a lot of speed optimizations with the framework so your app will feel more native than your typical hybrid app built purely with PhoneGap. The framework is still in alpha but I have been impressed with it.

Resources