I am a new bee to phonegap and want to clarify some doubts .
I have heard that phone gap allows you to code for one platform and then code for all platforms can be created(or reused ) via some commands and then one just needs to do some tweeking around for new platform added .
However i see that when i created my app for android and then i called cordova platform add ios command , the code for ios was not auto generated or the same code could not be be reutilised . ie for me now i had to code again .
Question : Was i wrong to assume that this can be done ? can it be done and if yes what are the steps for auto-generating code for a newer platform .
If i have to create code for new platform say ios again from scratch i don't know what benefit does phonegap provides me . ?
Phonegap doesnt generate the code for you. I mean, you code in javascript, html and css and you use this code throughout the different platforms. Sometimes, you have to modify it because the calls to internal functionalities can change. But PhoneGap is not a code generator, is not a cross compiler, it´s just a wrapper which embeds your code in a webview and by using the cordova tools, you can generate the skeletons, for every platform, but it wont generate code for you automatically, the code is the one you have made in HTML5. You can take your www folder from iOS and put in in the android skeleton you have created and try it. Sometimes it works from the beginning...and some times, which are the most of the cases, you have to do some fixes to polish the code. Hope it helps
Related
I am developping an app on Ionic version 3.9.2, for android tablets. I am working under windows 10 with Visual Studio Code.
In my plaform folder, I have only one device : my physical Android device.
The way I process to fix some CSS details is that I simply launch a
ionic serve command, find my HTML element, and update the main.css file located in the www/build folder (I am not using SCSS).
This works okay until I decide to check if everything looks good on my android tablet : I will launch a cordova run android, and then all the CSS changes are lost - even if I go back on my browser, and launch a new ionic serve.
Please note that I am talking about very basic styles, like colors and font size, not platform-specific styles.
I am not sure this behavior is because of the target device itself; it's looks like the changes will be included successfully on my testing platform until I decide to change the platform, and then the new platform will erase my changes because it's taking over the building process.
Is that possible ?
Maybe should I stop switching between those 2 commands ?
Or maybe should I edit both CSS files (www/build/main.css and platforms/android/assets/www/build/main.css) at the same time, which require a lot more work ?
Any help appreciated.
Oh of course, I shouldn't edit this CSS file.
Instead, edit the right SCSS file inside the SRC folder.
Thanks for your answer.
Looking through the documentation (https://facebook.github.io/react-native/) it seems you need 2 different files ones with file ending in .ios the other .android
I find it hugely confusing now I'm starting to write code do I need 2 repos to write this code
Yes, you do need to write to the specific platform you are working on at the time. If you are working on iOS / Xcode, then the .ios files will automatically be the once run when compiled, and vice versa.
If you are not writing any platform specific code, you can copy the code from whatever components are working on in your current platform over to the other platform, and they should work fine there.
You could use some strategy to share the same code base.
I found a project where it was made:
Mobile, desktop and website Apps with the same code -
https://github.com/benoitvallon/react-native-nw-react-calculator
I built an iOS app for a company i know, now I'm trying to make that same app for android. Just clicking the "Android" button in the xml file doesn't work. Do I have to rewrite the whole app again or is there some other way I can easily make that same app for android?
No, You don't need to rewrite the whole code again. But you should have to make some platform specific codes. Also some controls like Toolbar will not be available for Android. You can check the platform using Ti.Platform.osname or getOsname() method, which will return the osname(android/ios). In short, all other code will be work in android platform also.
I am new to phonegap platform. Have some queries plz help me out.
First of all my question is that "what exactly is cordova cleaver"? plz answer in layman language.
Second if somebody says "each module running through one main webview object" then does this mean that the app has only one webview.
Thanks,
Vishal.
with cleaver you can change a native view to show html
If you want to use cleaver, you have to include cordova as a framework.
in the .dmg you have a pdf explaining the steps to include cordova as a framework and how to use it.
I supose you need cordova installed, because if you don't install it, you can't get the cordova.framework
i am new to sencha touch & phone gap.i want to run simple hello word app in eclipse.but i dont know how to do it.if any one knows it than let me know fast
Thanks in advance
Aamirkhan I.
UPDATE:
Well there is a plugin availble for eclipse in which we can easily create any sencha,jquery mobile,phonegap project's,just need to follow some steps to integrate that plugin..see MY POST for that plugin guide,i updated my answer just to help other's who don't know how to write sample application in phonegap eclipse.
Thanks
follow this folder structure.
---your application name
-------src
--------------your activity class
-------gen
--------------generated files
-------android2.2
--------------generated files
-------Referenced Library
--------------Phone gap referenct which is placed in the libs folder
-------assets
--------------create folder www
---------------------place your html files & create sub folders for sencha files(
-------bin
--------------auto generated files
-------libs
--------------phonegap-1.3.0.jar
-------res
--------------some auto generated files
--------------create xml folder in that place phonegap.xml and plugins.xml files
-------Android Manifest
-------proguard.cfg
-------project.properties
Start by doing the Getting Started tutorial of PhoneGap on whatever OS you want to work.
http://phonegap.com/start
You should get your Hello World pretty easily
And if you want to go further you can do that great Sencha Touch tutorial :
http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/
Hope it helps
I would suggest you to use Apatna studio for the Sencha client development. It helps to build web applications quickly and easily and it is one of the Eclipse based powerful web development engine.
http://aptana.com/
Find Aptana Studio 3 Release Updates site: http://download.aptana.com/studio3-rcp/plugin/update/
Another alternative is Spket plugin for eclipse for Javascript. Spket Update site: http://www.spket.com/update/
Once your are done with the client development, you can follow the below link to build the different version of mobile application builds using phone-gap. Visit here for Phonegap developers reference link