Developing Hybrid Applications with IONIC

57
WELCOME TO CROSS PLATFORM MOBILE WORLD & MY PRESENTATION uat Buğra AYDIN Hybrid Apps with Cordova, Angular & IONIC 1

Transcript of Developing Hybrid Applications with IONIC

Page 1: Developing Hybrid Applications with IONIC

1

WELCOME TO CROSS PLATFORM MOBILE WORLD & MY PRESENTATION

Fuat Buğra AYDIN

Hybrid Apps with Cordova, Angular & IONIC

Page 2: Developing Hybrid Applications with IONIC

2

Content• Mobile World• Native Applications & Cross Platform(Hybrid Applications) ?• Cordova and Cordova Architecture• Cordova Installation• What is IONIC?• Why IONIC ?• What technologies does it use ?• Ionicons• Some Ionic directives• UI Component Overview• IONIC CLI• Ionic and Android Project File Structure• Let’s code something• Ionic Creator• References

Page 3: Developing Hybrid Applications with IONIC

3

Apps in Mobile World

Page 4: Developing Hybrid Applications with IONIC

4

Do you need a mobile app ?

Page 5: Developing Hybrid Applications with IONIC

5

•Native applications•Cross platform(hybrid) applications

You have 2 chance:

Page 6: Developing Hybrid Applications with IONIC

6

• Platform specific• Respective development tools• Best performance• Time consuming• Expensive development

Native Apps

Page 7: Developing Hybrid Applications with IONIC

7

Programming Language IDE App

Native Development

Page 8: Developing Hybrid Applications with IONIC

8

Well.. Want to support all major platforms even mobile web ?

Page 9: Developing Hybrid Applications with IONIC

9

You need cool web technologies..

Page 10: Developing Hybrid Applications with IONIC

10

•Platform independent(IOS, Android, Windows phone etc.)•HTML5,CSS3 & JS• Limited performance•Quick development•Direct access to native APIs with Cordova

Hybrid Apps

Page 11: Developing Hybrid Applications with IONIC

11

More Platforms, More Problems

Page 12: Developing Hybrid Applications with IONIC

12

Apache Cordova is a platform for building nativemobile applications using HTML, CSS and

JavaScript

Page 13: Developing Hybrid Applications with IONIC

13

Cordova Architecture

Page 14: Developing Hybrid Applications with IONIC

14

• Amazon Fire OS• Android• Bada• Blackberry• FirefoxOS• iOS• Mac OS X• Qt• Tizen• Ubuntu• WebOS• Windows (desktop)• Windows Phone 7• Windows Phone 8• Browser

Platforms• Battery Status• Camera• Contacts• Device• Device Orientation• Dialogs• File Transfer• Geolocation• Globalization• In-App Browser• Media Capture• Network Information• Splashscreen• Statusbar• Vibration

Plugins

Page 15: Developing Hybrid Applications with IONIC

15

Installing Cordova

$ npm install -g cordova

Page 16: Developing Hybrid Applications with IONIC

16

What is Ionic ?

Page 17: Developing Hybrid Applications with IONIC

17

•A Front-end framework for mobile apps•Contains a lot of mobile-optimized HTML, CSS and JS components•Best Friend with AngularJS•Uses Cordova to create, build,run, deploy mobile apps

Page 18: Developing Hybrid Applications with IONIC

18

Why Ionic ?• You can prepare the smooth interface and a practical

way.• Using Modern Web Technologies• The performance-oriented hybrid roof you can see in the

market.• Any changes you make with livereload seems to be instant.• You can prototype your application with "Ionic Creator".• You can upload your application to "Ionic View".• You can develop your application with the module angularjs state.• You can code with SASS on CSS side.

Page 19: Developing Hybrid Applications with IONIC

19

What technologies does it use ?

Page 20: Developing Hybrid Applications with IONIC

20

Superheroic JavaScript MVW Framework

AngularJS Provides; Directives, Filters, Dependency Injection, Two-way data binding, Services,

Testability

Page 21: Developing Hybrid Applications with IONIC

21

•Server side applications with JavaScript•V8 JavaScript Engine(Google)•Non-Blocking IO, asynchronous

mechanism.•Very Fast•npm is used to manage modules and

packages.• ..

Page 22: Developing Hybrid Applications with IONIC

22

•Compress CSS files.•Compress JavaScript files.•Collect the CSS and JS files to a single

file.• You can create watcher to see changes

instatly• …

Page 23: Developing Hybrid Applications with IONIC

23

•Developed by Twitter.•Uses Git Version system•Don’t need to go to development tool location.

$ bower install bootstrap

Page 24: Developing Hybrid Applications with IONIC

24

Ionicons

Over 700 MIT licensed font-icons includedionicons.com

Page 25: Developing Hybrid Applications with IONIC

25

Usage of Ionicons

Page 26: Developing Hybrid Applications with IONIC

26

Ionic solves multiple device resolution issues

Page 27: Developing Hybrid Applications with IONIC

27

Let’s see some ionic directives

Page 28: Developing Hybrid Applications with IONIC

28

• ion-header-bar: Adds a fixed header bar above some content.

• ion-footer-bar: Adds a fixed footer bar below some content.

Page 29: Developing Hybrid Applications with IONIC

29

• ion-content: Provides an easy to use content area that can be configured to use Ionic’scustom Scroll View

• ion-list: The List is a widely usedinterface element in almost any mobile app.

• ion-item: List items with its format.

Page 30: Developing Hybrid Applications with IONIC

30

UI Component Overview

Page 31: Developing Hybrid Applications with IONIC

31

List Dividers

Page 32: Developing Hybrid Applications with IONIC

32

Example to List

Page 33: Developing Hybrid Applications with IONIC

33

Side Menu

Page 34: Developing Hybrid Applications with IONIC

34

Slide Box

Page 35: Developing Hybrid Applications with IONIC

35

Action Sheet

Page 36: Developing Hybrid Applications with IONIC

36

Page 37: Developing Hybrid Applications with IONIC

37

Install Ionic & Cordova Globally

$ npm install -g ionic cordova

Page 38: Developing Hybrid Applications with IONIC

38

Clone demo project

$ ionic start <project name> <template name>

Page 39: Developing Hybrid Applications with IONIC

39

Ionic Templates

Page 40: Developing Hybrid Applications with IONIC

40

Ionic Project File Structure

Page 41: Developing Hybrid Applications with IONIC

41

Test on Web Browser

$ ionic serve

Page 42: Developing Hybrid Applications with IONIC

42

It is time to Google Chrome to test dynamic changes

Page 43: Developing Hybrid Applications with IONIC

43

Add a platform

$ cd <project name>

$ ionic platform add <platform name>

Page 44: Developing Hybrid Applications with IONIC

44

Build application

$ ionic build <platform name>

Page 45: Developing Hybrid Applications with IONIC

45

Android Project File Structure

Page 46: Developing Hybrid Applications with IONIC

46

Run on device/emulator

$ ionic emulate <platform name>

Page 47: Developing Hybrid Applications with IONIC

47

ngRouter ui.router

ngRouter vs ui.Router

• Single ng-view• Nested view is problem• Focus url on transition

• Multiple uı-view• Nested view• Focus url and state on transition

Page 48: Developing Hybrid Applications with IONIC

48

UI Router

Page 49: Developing Hybrid Applications with IONIC

49

Let’s code something

Page 50: Developing Hybrid Applications with IONIC

50

Create data by using controller in app.js1

Don’t forget to add the ng-controller attribute to body

Page 51: Developing Hybrid Applications with IONIC

51

List items with ion-items using ng-repeat in ion-list

2

Don’t forget to add complete class to style.css file.

Page 52: Developing Hybrid Applications with IONIC

52

3

Don’t forget dependency injection.

Let’s add a button to the icon-header-bar and create a function that use $ionicPopup.prompt .

3.1

3.2

Page 53: Developing Hybrid Applications with IONIC

53

Let’s add ion-option-button’s for Delete and Edit

4

Page 54: Developing Hybrid Applications with IONIC

54

Let’s add edit function and use $ionicListDelegate.closeOptionButtons()

5

Don’t forget to add $ionicListDelegate.closeOptionButtons()

to close the option buttons and its Dependency Injection.

Page 55: Developing Hybrid Applications with IONIC

55

Ionic Creator

Page 56: Developing Hybrid Applications with IONIC

56

References• https://cordova.apache.org/• http://ionicframework.com/• https://www.thepolyglotdeveloper.com• http://tolga.gezginis.com• https://kodcu.com• http://cihadhoruzoglu.com• http://www.nodejstr.com• http://www.w3schools.com/angular/• http://blog.teamtreehouse.com

Page 57: Developing Hybrid Applications with IONIC

57

Questions ?