Simultanious iOS and Andriod Development


#1

Just wanted to share my personal preference for working on a combined iOS and Android app at the same time with PhoneGap on a Mac. Also curious if there are other methods out there that others prefer.

For me, I create a new ‘www’ directory at the same level as the android and iOS platform directories. …/StarterApp/platforms/www

I then delete the www folders from the iOS and Android versions (save the Android cordova.js though) and create symbolic links where they used to be, back to the shared www folder:

ln -s ../../www/ www

Similar to this: http://www.christianengvall.se/phonegap-and-multiple-platforms/

The last step is to add a small amount of logic to my index.html file to choose the proper cordova.js file. I rename the Android cordova.js that I saved before as cordova-android.js and put it in the www directory with the iOS version. Then I edit index.html to have:

    <!-- cordova script -->
    <script type="text/javascript">
        if (navigator.userAgent.toLowerCase().match(/android/)){
            document.write('<script charset="utf-8" src="cordova-android.js"><\/script>');
        }
        else {
            document.write('<script charset="utf-8" src="cordova.js"><\/script>');
        }
</script>

Just curious if others have a better process and hope that this might also be of use to anyone else. Only issue I have ever had is just getting the www folder recognized by xCode and Eclipse sometimes. I think it is a different solution every time.

Hoping to test the new PhoneGap Developer app soon too. http://www.raymondcamden.com/index.cfm/2014/4/21/PhoneGap-Developer-App