Hello this is my first time i use cordova and ionic for android app , my qustions is :
1-in this app i just want use html css and js for design , so i must use cordova ?
2-i have a method in js get the latitude and longitude then show some values to user, but i need this method use in background and do this work automaticly all day , i need use java code ? or i can do it with cordova and ionic ?
3- if i need use to hardware in android , is better use java or cordova plugins ?
4- where is webviw cordova use for show index.html ?
i read to many way and i confuse to how can i do , i need best practis way to make hybrid app , pls help and show me the way .
Don't worry, we all have to begin some day. Let me first clear your few doubts about Cordova.
Cordova wraps your HTML/JavaScript app into a native container which can access the device functions of several platforms. These functions are exposed via a unified JavaScript API, allowing you to easily write one set of code to target nearly every phone or tablet on the market today and publish to their app stores.
so in short cordova helps you to access device functionality via javascript.
Ionic is a mobile css framework, which is built on top of angular js and allows support for cordova functionalities.
Now I will give answer's for your all questions:
Yes, if you want to create a mobile app using html and js, you need to use cordova. Since, cordova will wrap these files in the native container of respective mobile os.
You can run the task in background using cordova. There is a plugin for that which you can use Cordova Background Plugin
purpose of cordova is only, to allow device hardware access via javascript
You don't need to code anything to show index.html, cordova will do everything for you while building the app
Related
I have developed an application using Angular 7 with Responsive Web Design(RWD). I have converted this application into an Android APK that runs the app inside a webview. However, I have found Some of features of Native app ( like Opening Camera,Open file browser) in android App not working.
What extra effort would be needed to convert an RWD to webview Android App?
Javascript nor code running inside a webview by their nature, do not have access to a device's hardware. You will need to access the OS's native code to be able to use them.
The easiest approach I would recommend is using a hybrid app platform such as cordova.
I want you to open a link in my app via browser not in Appview. I ma making my html5 mobile app via xdk. I don't want to use cordova in my app as my app is heavy enogh and don't want to make it heavier because of just one link.
I saw this :
www.kidzout.com
But the problem is I must install Cordova InAppBrowser plugin for this to work. Do you have any solution without using Cordova or external plugins? Do you think is it possible at all?
You can open a link in the native browser(Mobile Safari, Android, etc.) from within a HTML5 Mobile app using the intel.xdk API formerly AppMobi.
In the head, include a reference to the intelxdk.js file.
<script src="intelxdk.js"></script>
Use this for opening your link:
Launch in Browser
For more information, go to http://www.html5dev-software.intel.com/documentation/jsAPI/device/launchExternal/index.html
If you are opening a remote URL in your webview and adding javascript is not an option, you can make a patch in native code.
Here I show the workaround for Android:
https://stackoverflow.com/a/35037737/813951
I am making a Hybrid Application using cordova-cli. My requirement is that the first page in my application must redirect to a website. The entire data required for the application will be loaded into this website from some other data-sources.
The requirement is to access device native features such as camera, accelerometer etc. from pages on this website.
I am using
location.href="http://www.example.com";
to open the pages. I need a unified cordova.js file with all the plugins embedded into it.
Currently I am putting the individual plugins into the lib\android\plugin\android and by using the grunt -f command from grunt-cli, the cordova.js file recieved for android does not seem to produce expected results.
Can't be done I am afraid - because of the way Cordova interacts with the device.
What happens if, using a non-mobile device, you accessed the same website from elsewhere? The website will not know what on earth Cordova is.
Cordova interacts with the native code on the device, so requires this to handle the passing of JS-to-native, and vice-versa.
I am new to phonegap and android, I have create a hello world application this link and it worked, but I don't know what 's the next step. I try to read API document from above link but it isn't easy to understand. For example, I don't know how to communicate between android code and js (how can I call android method from javascript and get value from android code to display in hmtl). I know ajax, but in this case I don't know how to use it.
So, I 'm looking for phonegap android ebook or a complete documents and tutorials.
Any help would be appreciated.
You dont need to bother about android methods in phonegap. Phonegap has its own method to write a android application. You can just use Jquery mobile along with phonegap to built apps. Basically phonegap is a container for jquery mobile helps to built apps with in built style and user interface and also it has own method to interact mobile device with their own methods.
just go through this following documentation and you will get a better idea about phonegap and jquery mobile.
Phonegap UI development with JQuery Mobile
Phonegap Working Examples
I am gonna develop a mobile application for multiple devices, say iPhone, iPad and Android Devices like Samsung Galaxy, Samsung Tab and Samsung Galaxy Nexus,
The application is about listing set of information from webservice to list in the application, So I decided to go for Mobile Web app using jquery mobile,
I want to publish the app in Appstore and Android Market, So I want to wrap the Mobile web in to a Native app, I thought an idea of implementing it in a UIWebView in iOS and WebView in Android,
Another option I found out is phoneGap,which provide an SDk to wrap an Web app into a Native iOS or Android App.
Can you people suggest me , Is it better to go with WebView in your native application, or is it really required to use phoneGap, Whether apple will approve my Application if I am using Mobile Web app in a UIWebView, Kindly Suggest.
Note: In my application there is no real need of Using any native functionality of iOS like, Camera, Contacts etc, I just wanna have a list with information fetched from the Webservice.
If you don't need any of the native features phonegap/callback gives you, do not use it. It's a bloated project that will probably add a ton of features you don't need, if you only need a wrapped web application.
Just use a regular webview, enable JS, caching etc and load your HTML into it.
Use phonegap. http://phonegap.com/
If u use it you can use the phonegap build service to generate apps for all platforms via it. you will only have to worry about the js, html part of the app, like you said.
Or if you dont want to use the phonegap build, still creating your own apps with phonegap is way easier as you dont have to write ANY native code.
There were some issues in Phonegap before because of which Apple was rejecting Phonegap apps previously. Thats fixed now, so thats no problem. :)