Notes on Migrating A Web App to Android App - Gotchas


#1

I have been compiling a list of things that went wrong during my first migration of an Angular 1.3 / Ionic 1.3 webapp over to an Android app.

FACTORIES & SERVICES

  1. If you are calling an API - make sure you use absolute URLS.
    EX:
    WEB API URL: /api/do-something/?id=1
    ANDROID API URL: http://yoursite.com/api/do-something/?id=1

AUTHENTICATION
2) Cookies don’t work on Android - use tokens for authentication and use localStorage to store authentication / session token and userdata (nothing critical though :wink: - good tutorial here: http://stackoverflow.com/questions/22165024/authentication-in-ionic-cordova-app

ROUTING
3) In index.html you need to change your base URL
EX:
WEB TAG: <base href="/index.html" />
ANDROID TAG: `

EXTERNAL LIBRARIES
4) I had trouble loading external libraries from CDNs - like jquery, etc. So I saved them to my local directory and loaded from my own server.

That’s all for now - feel free to add any other GOTCHAS! I will add more as I find them.

`