39,59 €
With the world becoming more mobile, there is a growing need for mobile websites and applications. Building these from scratch is not a simple process. Kendo UI Mobile makes building websites and applications easier than ever before. Build applications for phones and tablets in no time at all and provide your user with a native look and feel.Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API helps you to understand the concept of building mobile applications using HTML5 based frameworks, specifically Kendo UI Mobile. It teaches you in a simple step-by-step manner how to create a service backend layer using ASP.NET Web API and how to integrate it with your front end mobile application, which is the missing piece of the puzzle for most developers who are new to mobile applications development. Learn everything from the basics of HTML5 to design and development of a mobile application using Kendo UI Mobile and ASP.NET Web API. Integrate them in the right way using extensible and maintainable JavaScript code.Starting with the basics of the Kendo UI platform, learn how to build a real world mobile application from scratch. You will explore the Kendo UI framework elements and integrate the sample mobile application with the ASP.NET Web API service. One of the most important things that you will learn from this book is how to organize your code using the JavaScript Revealing Module Pattern. You will also take a journey through Kendo UI Mobile widgets with lots of code samples hosted in jsFiddle. At the end of this book, you will complete the integration of the sample application and master fixing real world problems utilizing your newly acquired professional techniques that will save you time and effort.Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API will help you improve your mobile application development skills using hands-on examples, and will help you address the common problems faced by beginners as well as experienced web programmers.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 224
Veröffentlichungsjahr: 2013
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2013
Production Reference: 1060913
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-092-2
www.packtpub.com
Cover Image by Nishanth Nair (<[email protected]>)
Authors
Nishanth Nair
Ragini Kumbhat Bhandari
Reviewers
David J McClelland
Morteza Sahragard
Brian Seekford
Acquisition Editor
Martin Bell
Lead Technical Editor
Sweny M. Sukumaran
Technical Editors
Akashdeep Kundu
Shiny Poojary
Project Coordinator
Arshad Sopariwala
Priyanka Goel
Proofreader
Joanna McMahon
Indexer
Hemangini Bari
Graphics
Abhinash Sahu
Production Coordinator
Pooja Chiplunkar
Cover Work
Pooja Chiplunkar
Nishanth Nair is a Mobile Solutions Architect, currently working as a Consultant for Sears Holdings Corporation. He holds a bachelor's degree in Computer Science and Engineering and has extensive experience with .NET technologies working for companies such as Accenture, McAfee, and Neudesic. He is a Microsoft Certified Application Developer and a Microsoft Certified Technology Specialist. In his free time, he likes to play cricket, tennis, and watch movies.
I would like to thank my wife Soumia, for all her support and patience while I wrote the book. Thank you for being such a wonderful wife! Many thanks to my parents, Sreedevi and Ramachandran Nair, and to my sister Nishi Nair for their love and encouragement.
Thanks to my friends Santhosh Karuthethil, Krishnanunni Pattiyil, Ashin Das, Aneesh Pulukkul, Sinto Antony, Anish Vasudevan, Mahesh Nair, and Lakshmi Ravi for being great friends forever. Also I would like to thank my ex-colleagues and buddies at Davita VillageHealth, Anita Nair, Alison Massey, Patrick D'Coster, Satheesh Ambat, Srinivasa Rao, Aruna Shanthaveerappa, and Sarika Goel for all their support and encouragement.
Thanks to my buddy and mentor Rajiv Kolagani who is always an inspiration to me.
Thanks to all my NECAB Core friends, Balachandran Warrier, Sudeesh Yezhuvath, Prakash Bare, Sahasranam, Promod PP, Snehaprabha, Rajeev G, Aji John, Jojy Varghese, Manoj KC, Sivaram P, Kiran, Syam Chand, Hitha, Dhanya V, Minu P, Ragesh, and all the others for being best friends forever!
Many thanks to the Packt Publishing team who made this book happen – especially Martin Bell, Sweny Sukumaran, Priyanka Goel, Arshad Sopariwala, Shiny Poojary, and Akashdeep Kundu.
I am greatly indebted to the reviewers of this book, Brian Seekford, David McClelland and Morteza Sahragard for the wonderful job they have done.
Ragini Kumbhat Bhandari is working at eMids Technologies Private Limited as a Technical Lead. She holds a Master of Computer Applications degree in Computer Science and she is a Microsoft Certified Technology Specialist.
During the course of her career she has worked extensively on .NET and mobile technologies. She finds happiness in sharing knowledge and educating the next generation of software professionals. Apart from spending time on the computer, she likes listening to music.
I would like to thank my parents, D.S. Kumbhat and Sheela Kumbhat, for their encouragement, patience, and support. I would like to thank my company eMids for providing a work culture which inspired me to contribute beyond work. Many thanks to the Packt Publishing team and the reviewers of the book.
David J McClelland has been creating cutting-edge software and content that bridges design, development, and information for over 20 years. He is currently a Principal User Interface Engineer, developing software to manage distributed devices via the Cloud.
I would like to thank my family for encouraging many of my technical and artistic interests.
Morteza Sahragard was born in Iran, and received his Bachelor of Science degree in Software Engineering. He started programming in the middle of 2000 with Pascal and then C++. With the increasing popularity of the .NET platform, he turned to the Microsoft programming framework and since then he has been involved in various kinds of applications, from Windows to Web, Network to Multimedia, Mobile to highly distributed systems, and so on. In the middle of 2006 he created www.30sharp.com, which is nowadays a famous and well-known tutorial website about technical programming and designing stuff (in Persian). At the moment, he is working as a Senior .NET Developer in an international IT company in Armenia. You can also find him at his English blog: http://weblogs.asp.net/morteza.
Brian Seekford is an experienced software engineer and architect, and is the CEO of Seekford Solutions, Inc. He works with client-side, server-side, and mobile technologies with an emphasis on large scale n-tier systems. The primary technologies he utilizes are the .NET platform for the client and server side, and JavaScript/HTML5 for mobile development. He has worked for Walt Disney World, BP, GM, Delta, PwC, and others who utilize a variety of technologies and hardware. He also built and sold ActiveX controls for network communications and web technologies for 11 years.
I would like to thank my wife and children for putting up with me.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
The sudden explosion of mobile devices has made mobile apps development one of the hottest career fields for programmers. The global smartphone/tablet market shared by multiple platforms posed a serious question to mobile application developers and companies, as every mobile platform has different development frameworks and programming languages to develop native applications.
How can we achieve WORA (Write Once, Run Anywhere)?
The obvious solution was HTML5, which is supported by all the latest browsers and has great support for developing rich user interfaces. With the introduction of platforms such as PhoneGap, which exposes the native OS APIs to apps developed in HTML5/JavaScript and CSS3, HTML5-based applications became a double-edged sword. They can be developed using one code base and deployed as a mobile website as well as mobile apps which can be installed on different platforms, as opposed to developing native apps which will result in multiple code bases if multiple platforms are targeted. The availability of a large number of web developers in the industry who understand HTML, JavaScript, and CSS added a boost to the shifting direction of mobile apps development towards HTML5. As the demand increased for more and more mobile applications, both in enterprise and consumer areas, different types of HTML5-based development frameworks surfaced and are still surfacing!
Kendo UI Mobile from Telerik is one of the fastest growing HTML5- and jQuery-based cross-browser mobile applications development frameworks. KendoUI Mobile distinguishes itself from other frameworks by providing adaptive native UI rendering out of the box, without any extra coding, and supporting the Kendo base application development framework. While other mobile development frameworks concentrate on the UI part only, Kendo UI provides support for end-to-end, client-side development.
As the world is getting closer to the HTTP protocol, Web APIs (services which are exposed over plain HTTP) are gaining momentum. ASP.NET Web API helps to build powerful Web APIs, which can be consumed by a rich set of clients and is now the number one choice for .NET developers to build RESTful applications.
This book will introduce you to Kendo UI Mobile and will show you how to build an end-to-end mobile app using ASP.NET Web API as the service backend.
Chapter 1, Building a Mobile Application Using HTML5, helps a programmer, who is relatively new to the mobile applications development world, pick up on this journey to build an end-to-end app using Kendo UI Mobile. The chapter details different types of mobile applications such as native, hybrid and mobile websites, an introduction to Kendo UI Mobile, and wraps up with mobile applications design guidelines.
Chapter 2, Building Your First Mobile Application, introduces you to Kendo UI Mobile code in detail, and some screens for the Movie Tickets app will be developed explaining views, layouts, navigation, and more. From this chapter we get our hands dirty and write some really cool code.
Chapter 3, Service Layer with ASP.NET Web API, introduces you to one of the latest additions to Microsoft .NET stack, ASP.NET Web API. We will see routing, parameter binding, content negotiation, token-based authentication, authorization, and write some API methods which will be used for the sample Movie Tickets application. Readers not from the Microsoft background can skip this chapter as well as writing your own services with the same functionality on a platform of your choice or use the service hosted by us on the Internet. The frontend Kendo UI Mobile client application is independent of the backend API technology and will work with any service platform as long as it accepts and returns the same JSON data.
Chapter 4, Integration Using Framework Elements, discusses the common Kendo Framework elements such as DataSource, Templates, and MVVM, which are used in both mobile and web application development. Then we will start backend integration with the Movie Tickets app by building the User Account screen, discussing the Revealing Module Pattern and the application architecture.
Chapter 5, Exploring Mobile Widgets, introduces you to the core of the Kendo UI Mobile Framework, the Mobile widgets. We will dive deep into widgets such as ListView, Button, ButtonGroup, and so on. Using the provided jsFiddle examples, users can play around with the sample code.
Chapter 6, ActionSheet, ModalView, and More Widgets, continues on from the previous chapter, and we will explore more Kendo UI Mobile widgets hands-on.
Chapter 7, Movie Tickets Application – Complete Integration, completes our Movie Tickets sample application by integrating with Kendo UI Mobile widgets, framework elements, and the ASP.NET Web API service.
This book is intended for novice and expert programmers with a web development background who want to build mobile applications or mobile websites for enterprise as well as consumer domains. A basic understanding of HTML, CSS, and jQuery is required to make good use of this book.
The following software are required to make full use of this book:
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Now let's create an action method in MoviesController.cs, which calls the GetMovieList BLL method."
A block of code is set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Two buttons, Open Left and Open Right, are placed on the NavBar widget in the layout of the views, which can be clicked to open the Drawer widgets as shown in the following code:
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the colored graphics from: http://www.packtpub.com/sites/default/files/downloads/0922OT_ColoredImages.pdf
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
The world is going mobile and millions of smart phones are activated daily. As a result, more and more mobile applications are developed for consumers, and enterprise software products are also slowly but steadily joining the revolution. More and more businesses are convinced that in order to sustain, they need to be in the mobile space. You are a web developer and one fine morning your manager tells you, "We now need to focus on the mobile platforms. Get ready!" or you want to develop a mobile app which needs to be deployed to one or more mobile app stores. There are many factors that play a part in choosing the appropriate mobile development platform, such as your development skills, native functionalities, security, offline capability, and support for multiple platforms. In this chapter, we will see different approaches for developing mobile applications and understand why HTML5 is a popular choice for cross-platform development. Then we will have an introduction to Kendo UI Mobile and will go over some design principles for mobile applications.
In this chapter we will cover:
As you may already be aware, there are three ways to develop a mobile device compatible application: native, hybrid, or mobile website.
Native apps are coded in a programming language specific to a platform, namely, Objective C for iOS, Java for Android, and so on. Native applications run faster, have access to all device APIs and features, and provide a better user experience. Since native apps are built for a particular platform, the entire application needs to be rewritten if a native application needs to run on another platform. This will create code duplication, maintenance headache, budget increase, and the need to have multiple development teams (specializing in a certain platform) working on the same business rules. Typically, games and applications which require high performance are developed as pure native apps.
Hybrid apps are written using pure web technologies (such as CSS, HTML, and JavaScript) and they run on the device in a native container using the device's browser engine. Hybrid apps are usually packaged using tools such as PhoneGap, which helps the app to access device-specific APIs and hardware features. WebKit rendering engine is used in platforms such as iOS, Android, and Blackberry to render the web-based script/code to be displayed in a web view control of the native platform. Since Hybrid apps are created using a native app shell, they can be distributed using app stores too. Icenium by Telerik is a cloud-based, all-in-one development environment to package, test, and deploy hybrid applications. PhoneGap is another commonly used tool for packaging web apps for deployment on multiple mobile platforms.
Mobile websitesare accessed using a URL and run in the mobile device's browser. They can be developed using server-side technologies, such as ASP.NET and PHP, and can be deployed and updated without any approval process from an app store. If the mobile website is written using pure web technologies (HTML, CSS, and JavaScript) or using frameworks based on them, such as jQuery, Kendo UI, and jQuery Mobile, mobile websites can be packaged to be installed as a hybrid application without much effort. A major drawback of mobile websites is that only device features that are exposed through the browser can be accessed, and this makes a mobile website suitable for content-based applications. There is no single solution which is suitable for all the scenarios. Selection of a methodology will depend on a number of factors, such as the skill sets you have, budget, time lines, and update frequency.
Kendo UI Mobile is an ideal platform for developing hybrid apps and mobile websites. During the course of this book, we will create a Movie Tickets application using Kendo UI Mobile which will be treated as a mobile website initially and then, towards the end of the book, it will be packaged using PhoneGap as a mobile app and deployed to Android as well as the iOS devices.
HTML5, jQuery, and CSS3 are the new mantra for developing cutting-edge web applications. When we say web, it includes the standard websites/applications, mobile websites/applications, as well as hybrid applications. Even though this book is about Kendo UI Mobile, it's important to have an idea about the underlying technologies behind the Kendo UI Mobile framework, namely, HTML5, CSS3, and jQuery. Let's take a high-level view at HTML5 and CSS3 technologies briefly before we take a deep dive into Kendo UI Mobile. Since we expect the readers of this book to have knowledge in jQuery, we won't be discussing the basics of jQuery here.
HTML5 shot to fame among the Internet public when Steve Jobs famously announced the death of Flash on the iOS devices and endorsed HTML5 as the future, as it helps to build advanced graphics, typography, animations, and transitions without relying on third-party browser plugins.
HTML5 is a markup language specification that is comprised of a significant number of features, technologies, and APIs that allow content developers to create a rich and interactive experience. HTML5 is still in the recommendation stage, but many browsers already implement a significant portion of the specification. This poses a challenge for developers as they need to figure out which browsers support which features before kick starting an HTML5 project.
Even though the specification for HTML5 is not complete yet, tons of features are already implemented by mainstream browsers. The following are some of the main features of HTML5 as it stands as of today:
http://html5rocks.com from Google is a very good website for HTML5 reference with tons of tutorials, articles, and other resources.
There are three different organizations behind the development of the HTML5 specification: W3C (World Wide Web Consortium), WHATWG (Web Hypertext Application Technology Working Group), and IETF (Internet Engineering Task Force). As a result, there are two versions of the HTML5 specification maintained by W3C and WHATWG, which can be found at http://www.w3.org/TR/html5/ and http://whatwg.org/html respectively.
