CapacitorJS for PWA/TWA - javascript

I'm planning to make a Webapplication for Web with should also work as PWA and TWA (on iOS and Android).
Now i'm evaluating if i can use some features like camera, geolocation, accelerometer, notifications and some more.
I tryed to make a demo project with CapacitorJS and wondering why i need to add native platforms to target and why there is a seperate folder "android".
I just want to create one Website/PWA which should run as Website, on iOS and Android (in Browser) and not start a second or third seperate project for iOS and Android.
How can i use CapacitorJS to target the Web and when the website is called from iOS/Android than the native functions from iOS/Android are used?

You can't use the native code in a TWA or PWA, that's the whole point of the native platforms, to use native code when the web don't have a proper equivalent.
With Capacitor you use the same code for web, native iOS and native Android, is up to you if you want to use native iOS and native Android or not, but to use it you have to publish the app on the App store and Play store, the PWA will always use web APIs.

Related

Which features of android are not supported in web apps/Cordova?

I want the description of features which can work fine in a native app(android), but not in cordova app as in used with android as a platform. In other words features of android which are not supported in cordova(android) application.
I guess you will find hardly any features, which native app can do and cordova app can't do. As main reason is "Cordova app is a native app", just with a full screen web view rendering HTML content.
For more info check Cordova site and quora thread.
There are plugins available to access different features.
If you are in conflict which to use read this answer.

developing android app using dreamweaver cs6

Good day/night everyone. I am looking to go into mobile app development and made some research. I found out that you could use javascrpt, html5 and css to develop applications using phonegap. I also found out that dreamweaver supports phonegap and android sdk as plugins. My question now is, if I want to develop an android app in dreamweaver, am I to use the android native code or will I use html5, css and javascript that phonegaps uses. Thanks.
Phonegap only support for HTML, CSS, and JavaScript. If you want add native functionality into hybrid app such as barcode scanner, camera or similar with that, you need to use cordova.exec.
Below is a list of phonegap plugin.
https://cordova.apache.org/
You can integrate native functionality into hybrid app also.
iOS: http://blog.revivalx.com/2014/03/10/androidios-adding-native-functionality-to-hybrid-application-with-apache-cordova-plugin/
android: http://blog.revivalx.com/2014/03/11/ios-adding-native-functionality-to-hybrid-application-with-apache-cordova-plugin/
Dreamweaver is web editing software, so you would use it for PhoneGap applications. If you want to do native development you will want to use Eclipse or Android Studio so you can compile the native code.

Common code base for HTML5/CSS/JS webapp and native app

I have been asked to create a webapp and native apps using HTML5/CSS/JS.
I should make some research, but i remember I heard about PhoneGap.
My basic question is this:
if i write a HTML5/CSS/JS that somehow interacts with a server backend (through webservices for example), this is a web application that a user can reach with a browser (or mobile browser) at a specific IP addresss.
If I "phonegap" the same code do I obtain an Android od iOS application that is already working or is there some more work in between? IF there is some more work this is not clear to me.
I am aware this is a generical question, anyway it is a programming question because I need to know if going for this single code base is an option or not.
Thanks!
I have recently built a hybrid web application using the same codebase that had to work on all major desktop browsers (down to IE8), mobile browsers and be installed as a "native-like" app on iOS and Android. For this I used jQuery Mobile and PhoneGap Build.
You can only use HTML, CSS and JavaScript for PhoneGap applications, so any data being retrieved from the server needs to be done via AJAX, but it works just fine.

How to communicate between titainum based iPhone application and native ios application

Team,
I'm new to titanium. I'm working on creating enterprise application for iPhone. I need to know is there any way to communicate between two iPhone applications? Where as one application is created as native iPhone application using objective c and other is created using titanium framework.
Kindly share ur thoughts how to do this.
Thanks
Shatthi
The Titanium application is actually converted into a native application. You can actually open the build' project in xcode and further develop it there. So there should be no difference to it.
On the other hand, communicating between iPhone apps is not really possible with apps. You can however open links with a prefix to other apps. This is explained here: http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/
I don't know the support for Titanium to actually create the url catchers. It can be done by Xcode as explained in above link. But because you want to communicate TO an native-build app, that app only needs to have the support to understand those links
You could also use this approach: link between apps modifying the editing menu (bubble-popup menu) - a similar way to do this

Is there access to the iPhone accelerometer using Javascript?

I'm starting to try and do some web based game programming for my iPhone, and other web enabled phones that my friends have, and was having a hard time finding information on accessing the accelerometer using Javascript in the browser.
With the latest release, I know I've got access to location information now but I was hoping that I could make use of the accelerometer for some of the games I plan on making.
Alternately, is this also possible with the Android phones?
In the latest iOS update (4.2) the accelorometer is now accessible from Javascript.
See: http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
iOS 4.2 provides Accelerometer & Gyroscope support through the DeviceOrientation API.
DeviceMotionEvent class
reference
DeviceOrientationEvent class
reference
Here a working javascript snippet.
If your are using iOS 4.2 or more, then you can do it: http://www.albertosarullo.com/blog/javascript-accelerometer-demo-source
jharlap is correct, however I'd be curious to know if this would work on the Palm Pre. Native development on the Pre is done using html and JavaScript, however there are special JavaScript APIs to access the phone's features that I believe only work for locally stored apps. I wonder if these are available through the browser. I doubt it, but it would be interesting.
Checkout PhoneGap project. It provides API to access the accelerometer and the GPS location from javascript.
"Regular" javascript cannot access the accelerometer info, it can access the geolocation using the W3C geolocation API supported by iPhone OS 3.0.
Yet, a project (e.g. PhoneGap) can be used to build a bridge between javascript and Objective-C capabilities to expose that functionality. This works if you want to deploy the app as a standalone application, that simply has one WebKit which loads the html content from the server.
I haven't played with their framework, but they provide templates for the iPhone and Android projects and you can work on developing your javascript game which would work almost-out-of-the-box on iPhone and Android. I cannot comment on the performance and the user experience though.

Categories