I have developed one web application that runs under all browser via applet (core is written in c).
Now, I planned to develop the same application for android, but android does not support Java Applets, I want to invoke my application via browser so I have to call my application using like applet or ActiveX but both are not supported by Android, do you have any idea on how to do this?
I'm affraid you are on your own here. If you like to have at least some compatibility with different android devices and versions your options are
native android app ( better in java, not in NDK - full access to platform features, compatibility depends on your skill)
crossplatform javascript in browser ( limited access to android features and hardware,
slow loading and compatibilitz depends on skill of cross platform toolkit provider )
supporting execution of arbitrary binary code in browser is security nightmare and is not going to happen on most browser under android
Android browsers do not support applets. I believe no mobile browsers do. Unlike iOS or Windows Phone, Android does have a Java VM, but it is neither binary nor API compatible with Sun's.
For example, Android introduces a completely different layout model and a different set of UI widgets.
So, you have no choice but to write an Android app from scratch. Luckily, Android uses standard JNI, therefore you have a good chance to reuse your C code (you will need to compile it with Android NDK).
Android uses a sophisticated mechanism of cross application interaction, known as Intents. These allow an installed app to register to handle certain kinds of URLs. That's how a link in Android browser can invoke the YouTube app to play a video full screen. Your web page can use a similar mechanism to switch from browser to your dedicated app, and return to the original web page can also be handled naturally.
Note also that your app can use Web view to display HTML pages - either local content installed as part of the app, or dynamic content retrieved from arbitrary Web site. This view uses the full browser engine, including javascript, and can interact with your Java code, but not with the same API as javascript interacts with applets.
Write native application based on your code or make your app more server side or webapp and drop applet
Related
Can Nativescript build apps for web as well?
As Ionicframework and similar uses Cordova to build Android and iOS the same code there can be served by an HTTP server to the mobile or desktop browsers.
Will that be possible with the apps built with Nativescript, using same code base for web version of the app?
Nowadays Angular integration is on the way, and using Angular for the mvc kind of things (like data bindings, events etc.) and using Native for the device apis, platform apis and native gui would help in an unequaled way.
Angular parts can be used in the browser as well when built for it. What to do with the xml written for the gui templates in Nativescript, they could be converted to proper html for web built of the app, as Nativescript itself already uses a unified gui api for different platforms, that could be possible. And lastly, native calls made in NativeScript would be ignored in the web build.
It would be great to build for Android, iOS, and Web with the same exact code base.
tl;dr: No
Longer: The big difference between the Cordova/Phonegap based technologies (such as Ionic and Supersonic) and the Dynamic Runtime based technologies (such as NativeScript, React Native and Titanium) is that the first uses a HTML approach where the application is run by WebKit/Blink in a WebView. Looking on the Dynamic Runtime technologies there's no HTML Engine running your app, but rather native views and widgets. The framework (in this case NativeScript) is "just" a bridge between Javascript and the native language of the device.
However, depending of how you architecture your code, you can create Javascript which will be usable in both a NativeScript environment as well as in a browser environment.
Edit: The above means that you could reuse some of your code. There'll still be NativeScript specific code.
Edit2: There's an ongoing project to enable usage of Angular 2 in NativeScript. Please see current status in the issue: https://github.com/NativeScript/NativeScript/issues/103 Also note that the Telerik NativeScript core developer Valentin Stoychev is saying
The idea [is] to enable as much code reuse as possible between your web and mobile apps.
So: Yes on code reuse - no on exact same codebase.
Adding to the (correct) response of Emil - I do not think it is possible to have any significant portion of the app shared (even for the logic part) since {N} apps mostly utilize the Nativscript observable implementation which would probably 'leak' into your models / view models.
Having said that, I suggest you to monitor the work happening on integrating Angular2, which would probably mean a larger code sharing potential (with Angular2 web apps)
While developing apps for Android using Html5. What are the restrictions that Html5 wont allow? For example my apps requirements are using local storage, copy paste files, opening socket, changing Android configurations for theme, and run the apps as daemon.
With Html5 will it be possible or i should skip using Html5 and go with other method?
Android doesn't natively support HTML5 apps. You're going to have a Java app that contains a WebView in which your HTML5 UI exists.
You can communicate between the Javascript inside the webview and the Java app on the outside with a couple of hooks. It's hacky, but you can always communicate out to the Java app and have the Java app implement the functionality you need.
Depending on how much work you're doing in HTML5 vs in Java, it may or may not be worth the hassle. Generally the Java UI will be much smoother.
I want to develop an application which works both in a regular browser and as an Android app. Both seem suitable but would I be right in saying if I went with Phone Gap, deploying the same html content as a regular, server hosted website is not trivial and would require modification? Also, are multi page applications not desirable in a Phone Gap wrapper?
Are there any alternatives I should consider? I'm surprised someone hasn't already written an Android wrapper with all the hardware access wiring done already. Or have they?
There are few things you should know,
If you are going to publish your app also on iOS, you can't use server hosted website for your app.
All of your basic functionality must stand on your app assets, is one of the iOS guidelines, and its also make-sense for best ui performance (both iOS & Android).
Use server-side wisely, when you want to fetch data which have to be up-to-date.
there are some new mobile browser features which will be available in the future, that allow your website to use the device hardware functions:
Device API on W3C
Good luck dude ;)
You can try with jquery mobile framework:
http://www.jquerymobile.com
It is jquery based framework for developing web apps that works on standard web and on multiple mobile devices (with cordova)
It is just a webview that have many api to native functions?
Can I have a phonegap activity and a native activity in an app?
(1) Yes...PhoneGap provides a setup for every major mobile operating system that will create the same environment everywhere. This consists of a webview and a set of javascript functions that are mapped to native functions. This way you only need to develop one applications (based on HTML, CSS and JavaScript) and it can be run on any OS PhoneGap can provide its framework for.
Your application <--> Phonegap <--> Android
Your application <--> Phonegap <--> Windows Phone
Your application <--> Phonegap <--> iOS
Your application <--> Phonegap <--> ...
It takes having to deal with different operating systems away from you and instead you can focus on building your application, because you only "talk" to Phonegap and it will talk to the OS for you.
(2) Mixing the Phonegap webview application that is actually run by the phone with native stuff specifically created for one operating system will most likely end in disaster. That's not how Phonegap is supposed to work. And breaking out of PhoneGap's "jail", meaning it's JavaScript framework and the webview, will probably not work anyway. You can, however, open other applications on the phone and receive values from them. The question always is: On how many operating systems is this functionality available?
If you start asking questions like the one you just posted here... maybe you should first check that PhoneGap really is the right tool for what you want to do.
It is not a phonegap activity. It is just a web view that uses phone gap javascript functions. Thus you will not have such problems. You can easily implement most of your UI using HTML, still using some native controls for menus, animations etc.
Phonegap actually is a library that translates your javascript calls to instructions for the different OS like Android/iOS/Windows phone.
Phone gap is a intermediary layer that talk with your phone & between your application. Your application resides inside a chrome less browser & using phone gap api you connect to phone features like contact, camera, io etc...
Thus actually phonegap works.
Phonegap really works in 3 steps:-
1- Build App with Web standards: Developers already know how to make a web technologies using html5,css & javascript.
2- Wrap that with Phonegap: Using this phonegap build,one can get access to native API’s
3- Deploy to Multiple platforms: Phonegap actually uses standard based web technologies to bridges web application & mobile devices.
I am aware of Appcelerator and Phonegap's differences with regards to their approach in creating cross device/platform applications for Android and iOS. I believe one of Appcelerators advantage is that it has access over the device's API, correct me if I am wrong but isn't Phonegap also capable of accessing the device's API? My question is if both of them has access to the device's API, then what advantage does Appcelerator have over Phonegap in terms of API coverage? Which native APIs from Apple and Android devices can Appcelerator access which Phonegap cannot?
With the typical PhoneGap application, you're trying to mimic the native GUI elements in JavaScript, most likely with something like the Sencha Touch framework. However, with Titanium (Appcelerator is the company, Titanium is the product), you're using Native GUI elements.
To answer your question, when you're developing a simple application in PhoneGap, you're not using the native Table View, Tab View, Image View, etc. Instead, you're using JavaScript that tries to mimic those controls. So, in even the simplest of cases, you're not using native APIs with PhoneGap.
Considering you're able to write your own native code for either Android or iOS using PhoneGap, I don't think there are actual limitations in terms of API coverage beyond what comes with it out of the box. I just finished writing a plugin for PhoneGap that allows me to access the orientation gyros (ie yaw, pitch, roll) on Android because it didn't have one. Since PhoneGap fires up your class on initialization, you're able to inject whatever code you need before/after executing the super.loadUri statement.
PhoneGap is simply a wrapper that makes it easier to separate your presentation layer from the native device code by automatically loading up an html file in a chromeless browser and then listening for specific requests made from the browser back to the native code (ie, the plugins PhoneGap ships with). You're free to add additional native code around the PhoneGap wrapper.