Search code examples
angularadminangular2-template

Create Apk from angular 4 project


I wanted to create one application for administrator of society committee. I have used ngx-admin template created by aveko, but i don't know how to create apk of my admin application. I wanted to show how it will work on my real device after require modification. Does anyone know?


Solution

  • When you use Angular, you create Single Page Applications, known as SPA.

    This means that, opposed to languages such as PHP, you user doesn't request for a page to your server. In Angular, all of your pages are held by the user's computer.

    When creating SPA, you are using JavaScript. Javascript has nothing to do with Java. This means, if you want to create an APK, you will need to create a Java project.

    But fortunately for you, there is a framework called Ionic. This framework allows you to create APKs for your SPA applications.

    From what I have understood, it creates an application made of only a web browser, that will display your SPA. This tricks the user into thinking he uses a native application, but in fact, he uses a SPA.

    To acces the phone's properties, Ionic relies on another Framework, named Cordova. This framework give you an abstraction that allow you to access things such as contacts, pictures and such.

    Applied to your issue : you can use Ionic and Cordova, regardless of ngx-admin. Because in the end, you will build your application, thus making vendor scripts. Those scripts will contain every piece of Javascript your application uses, and that includes ngx-admin.

    Once you've built your application, Ionic will serve this SPA in a browser on your user's phone.

    So, all you have to do now, is use Ionic ! And another plus side : Ionic can also create iPhone applications.

    A little pice of advice : from what I've understood, you want to show your client what your application will look like on a phone, right ? In this case, you can deplloy your SPA on a server like a standard application, and reach for it with your phone. This will allow you to gain so much time that you will actually have time to discover Ionic on your own !