Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Kotlin for Android 14
Mastering Kotlin for Android 14

Mastering Kotlin for Android 14: Build powerful Android apps from scratch using Jetpack libraries and Jetpack Compose

eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Kotlin for Android 14

Get Started with Kotlin Android Development

Kotlin is a static programming language that allows you to write concise and typed code. It’s the language preferred for Android development by Google.

In this chapter, we’ll get to know Kotlin as a programming language. We will cover features that are useful for Android development and their importance for Android developers. Additionally, we’ll cover how to migrate from Java to Kotlin and some useful tips for developers coming from Java backgrounds.

In this chapter, we’re going to cover the following main topics:

  • Introduction to Kotlin
  • Kotlin syntax, types, functions, and classes
  • Migrating from Java to Kotlin
  • Kotlin features for Android developers

Technical requirements

To follow the instructions in this chapter, you’ll need to have the following ready:

You can find the code for this chapter at https://github.com/PacktPublishing/Mastering-Kotlin-for-Android/tree/main/chapterone

Introduction to Kotlin

Kotlin is a language that runs on the Java Virtual Machine (JVM) developed by JetBrains. It was developed to overcome the following challenges that Java had:

  • Verbosity: Java has a very verbose syntax and this leads to developers writing a lot of boilerplate code even for trivial tasks.
  • Null pointer exceptions: By default, Java allows variables to have null values. This normally results in null pointer exceptions, which has been called the billion-dollar mistake in Java as many applications have been affected by this.
  • Concurency: Java has threads, but managing concurrency and thread safety can be such a hard task at times. This leads to a lot of performance and memory issues that seriously affect applications that need to do work off the main thread.
  • Slow adoption of features: The Java release cycle is slow and it is difficult to use the latest Java version to develop Android apps as there’s a lot to be done to ensure backward compatibility. This means it’s hard for Android developers to easily adopt the new language features and improvements as they’re stuck using older versions.
  • Lack of functional support: Java is not a functional language, which makes it hard for developers to write functional code in Java. It’s hard to employ features such as high-order functions or treat functions as first-class citizens.

Over the years, Kotlin has evolved to be multiplatform and server-side and not serviced, and is used in data science as well. Some of the features where Kotlin has an edge over Java are as follows:

  • Conciseness: The syntax is concise, which in turn reduces the amount of boilerplate code that you write.
  • Null safety: Many Java developers are very familiar with the famous Null Pointer Exception that was a source of many bugs and issues in applications. Kotlin was designed with null safety in mind. Variables that can have null values are indicated when declaring them, and before using these variables, the Kotlin compiler enforces checks for nullability, thereby reducing the number of exceptions and crashes.
  • Coroutines support: Kotlin has built-in support for Kotlin coroutines. Coroutines are lightweight threads that you can use to perform asynchronous operations. It’s easy to understand and use them in your applications.
  • Data classes: Kotlin has a built-in data class construct that makes it easy to define classes that are used primarily to store data. Data classes automatically generate equals(), hashCode(), and toString() methods, reducing the amount of boilerplate code required.
  • Extension functions: Kotlin allows developers to add functions to existing classes without inheriting from them, through extension functions. This makes it easier to add functionality to existing classes and reduces the need for boilerplate code.
  • Smart casting: Kotlin’s smart casting system makes it possible to cast variables without the need for an explicit cast. The compiler automatically detects when a variable can be safely cast and performs the cast automatically.

JetBrains is also the company behind IntelliJ IDEA. The language support in this Integrated Development Environment (IDE) is also great.

Kotlin has evolved over the years to support the following different platforms:

  • Kotlin Multiplatform: This is used to develop applications that target different platforms such as Android, iOS, and web applications
  • Kotlin for server side: This is used to write backend applications and a number of frameworks to support server-side development
  • Kotlin for Android: Google has supported Kotlin as a first-class language for Android development since 2017
  • Kotlin for JavaScript: This provides support for writing Kotlin code that is transpiled to compatible JavaScript libraries
  • Kotlin/Native: This compiles Kotlin code to native binaries and runs without a Java Virtual Machine (JVM)
  • Kotlin for data science: You can use Kotlin to build and explore data pipelines

In summary, Kotlin provides a more modern and concise approach to programming than Java while still maintaining interoperability with existing Java libraries and code. In addition, you can write Kotlin code and target different platforms.

Now that we have got the gist of Kotlin and its various features, let’s move on to the next section where we will understand Kotlin as a programming language and understand Kotlin syntax, types, functions, and classes.

Kotlin syntax, types, functions and classes

In this section, we’ll be looking at Kotlin syntax and familiarize ourselves with the language. Kotlin is a strongly typed language. The type of a variable is determined at the time of compilation. Kotlin has a rich type system that has the following types:

  • Nullable types: Every type in Kotlin can either be nullable or non-nullable. Nullable types are denoted with a question mark operator – for example, String?. Non-nullable types are normal types without any operator at the end – for example, String.
  • Basic types: These types are similar to Java. Examples include Int, Long, Boolean, Double, and Char.
  • Class types: As Kotlin is an object-oriented programming language, it provides support for classes, sealed classes, interfaces, and so on. You define a class using the class keyword and you can add methods, properties, and constructors.
  • Arrays: There is support for both primitive and object arrays. To declare a primitive array, you specify the type and size, as follows:
    val shortArray = ShortArray(10)

    The following shows how you define object arrays:

    val recipes = arrayOf("Chicken Soup", "Beef Stew", "Tuna Casserole")

    Kotlin automatically infers the type when you don’t specify it.

  • Collections: Kotlin has a rich collection of APIs providing types such as sets, maps, and lists. They’re designed to be concise and expressive, and the language offers a wide range of operations for sorting, filtering, mapping, and many more.
  • Enum types: These are used to define a fixed set of options. Kotlin has the Enum keyword for you to declare enumerations.
  • Functional types: Kotlin is a functional language as well, meaning functions are treated as first-class citizens. You can be able to assign functions to variables, return functions as values from functions, and pass functions as arguments to other functions. To define a function as a type, you use the (Boolean) -> Unit shorthand notation. This example takes a Boolean argument and returns a Unit value.

We’ve learned the different types available in Kotlin, and we’ll use this knowledge in the next section to define some of these types.

Creating a Kotlin project

Follow these steps to create your first Kotlin project:

  1. Open IntelliJ IDEA. On the welcome screen, click on New Project. You’ll be presented with a dialog to create your new project as shown in the following figure:
Figure 1.1 – New Project dialog

Figure 1.1 – New Project dialog

Let’s work through the options in the dialog shown in Figure 1.1 as follows:

  1. You start by giving the project a name. In this case, it’s chapterone.
  2. You also specify the location of your project. This is normally where you store your working projects. Change the directory to your preferred one.
  3. Next, specify your target language from the options provided. In this case, we opt for Kotlin.
  4. In the next step, specify your build system. We specify Gradle.
  5. We also need to specify the Java version that our project is going to use. In this case, it’s Java 11.
  6. Next, you specify the Gradle DSL to use. For this project, we’ve chosen to use Kotlin.
  7. Lastly, you specify the group and artifact IDs that, when combined, form a unique identifier for your project.
  1. Click on Create to finalize creating your new project. The IDE will create your project, which might take a few minutes. Once done, you’ll see your project as follows:

Figure 1.2 – Project structure

Figure 1.2 – Project structure

The IDE creates the project with the project structure seen in Figure 1.2. We are mostly interested in the src/main/kotlin package, which is where we’ll add our Kotlin files.

  1. Start by right-clicking the src/main/kotlin package.
  2. Select New and then New Kotlin Class/File. Select the File option from the list that appears and name the file Main. The IDE will generate a Main.kt file.

Now that we’ve created our first Kotlin project and added a Kotlin file, in the next section, we will create functions in this file.

Creating functions

In Kotlin, a function is a block of code that does a specific task. We use the fun keyword to define functions. Function names should be in camel case and descriptive to indicate what the function is doing. Functions can take arguments and return values.

Create the main() function in your Main.kt file as follows:

fun main() {
    println("Hello World!")
}

In the preceding code, we’ve used the fun keyword to define a function with the name main. Inside the function, we have a println statement that prints the message "Hello Word!".

You can run the function by pressing the green run icon to the right of the function. You’ll see the console window pop up, displaying the message "Hello World!".

We’ve learned how to create functions and print output to the console. In the next section, we’ll learn how to create classes in Kotlin.

Creating classes

To declare a class in Kotlin, we have the class keyword. We’re going to create a Recipe class as follows:

class Recipe {
    private val ingredients = mutableListOf<String>()
    fun addIngredient(name: String) {
        ingredients.add(name)
    }
    fun getIngredients(): List<String> {
        return ingredients
    }
}

Let’s break down the preceding class:

  • We’ve called the class Recipe and it has no constructor.
  • Inside the class, we have a member variable, ingredients, which is a MutableList of Strings. It’s mutable to allow us to add more items to the list. Defining variables in a class like this allows us to be able to access the variable anywhere in the class.
  • We have addIngredient(name: String), which takes in a name as an argument. Inside the function, we add the argument to our ingredients list.
  • Lastly, we have the getIngredients() function, which returns an immutable list of strings. It simply returns the value of our ingredients list.

To be able to use the class, we have to modify our main function as follows:

fun main() {
    val recipe = Recipe()
    recipe.addIngredient("Rice")
    recipe.addIngredient("Chicken")
    println(recipe.getIngredients())
}

The changes can be explained as follows:

  • First, we create a new instance of the Recipe class and assign it to the recipe variable
  • Then, we call the addIngredient method on the recipe variable and pass in the string Rice
  • Again, we call the addIngredient method on the recipe variable and pass in the string Chicken
  • Lastly, we call the getIngredients method on the recipe variable and print the result to the console

Run the main function again and your output should be as follows:

Figure 1.3 – Recipes

Figure 1.3 – Recipes

As you can see from the preceding screenshot, the output is a list of ingredients that you added! Now you can prepare a nice rice and chicken meal, but in Kotlin!

Kotlin has tons of features and we’ve barely scratched the surface. You can check out the official Kotlin documentation (https://kotlinlang.org/docs/home.html) as well to learn more. You’ll also learn more features as you go deeper into this book.

We’ve learned how to create classes, define top-level variables, and add functions to our class. This helps us understand how classes in Kotlin work. In the next section, we will learn how to migrate a Java class to Kotlin and some of the tools available to use in the migration.

Migrating from Java to Kotlin

Are you a Java developer and have your apps in Java? Are you wondering how you could get started with Kotlin? Worry not, this is your section. Kotlin offers two ways for you:

  • Java-to-Kotlin migration: The IDE that we are using, IntelliJ IDEA, has a tool for converting existing Java files to Kotlin.
  • Interoperability: Kotlin is highly interoperable with Java code, meaning you can have both Java and Kotlin code in the same project. You can continue using your favorite Java libraries in your Kotlin projects.

Let’s see how to migrate a sample Java class to Kotlin using IntelliJ IDEA:

  1. Inside src/main/kotlin, open the Song class, which has a number of Java functions.
  2. Right-click the file and you’ll see the Convert Java to Kotlin option at the bottom. Select this and you’ll be presented the following confirmation dialog:

Figure 1.4 – Confirmation dialog

Figure 1.4 – Confirmation dialog

At times after a conversion, you might need to make some corrections and that’s why we have this dialog. Click Yes to proceed and you’ll see your code is now in Kotlin. This is a useful feature that handles a major part of the conversion to Kotlin and you also learn about the syntax.

Now that we’ve learned how to migrate Java code to Kotlin, in the next section we will cover some of the features of Kotlin that make it useful for Android developers.

Kotlin features for Android developers

Now that you have had an introduction to Kotlin, let’s look at why Kotlin is a great language specifically for Android development.

Google announced Kotlin as a first-class language for writing Android apps back in 2017. Since then, there has been lots of work done to make sure that developers have all they need to develop Android apps in Kotlin. Here are some of the features that developers can benefit from:

  • Improved developer productivity: Kotlin’s concise and expressive syntax can help developers write code faster and with fewer errors, which can ultimately improve developer productivity.
  • Null safety: Since Kotlin is written with nullability in mind, it helps us to avoid crashes related to the Null Pointer Exception.
  • IDE support: IDE support has been continuously improving. Android Studio, which is built on top of IntelliJ IDEA, has been receiving tons of features such as improved autocompletion support to improve the Kotlin experience.
  • Jetpack libraries: Jetpack libraries are available in Kotlin, and older ones are being rewritten with Kotlin. These are a set of libraries and tools to help Android developers write less code. They address common developer pain points and increase developer efficiency.
  • Jetpack Compose: Jetpack Compose, a new UI framework, is completely written in Kotlin and takes advantage of features of the Kotlin language. It’s a declarative UI framework that makes it easy for Android developers to build beautiful UIs for their apps.
  • Kotlin Gradle DSL: You are now able to write your Gradle files in Kotlin.
  • Coroutine support: A lot of Jetpack Libraries support coroutines. For example, the ViewModel class has viewModelScope that you can use to scope coroutines in the lifecycle of the ViewModel. This aligns with the Structured Concurrency principles for coroutines. This helps cancel all coroutines when they’re no longer needed. Some libraries including Room, Paging 3, and DataStore also support Kotlin coroutines.
  • Support from Google: Google continues to invest in Kotlin. Currently, there are resources ranging from articles to code labs, documentation, videos, and tutorials from the Android DevRel team at Google to assist you in learning new libraries and architecture for Android Development.
  • Active community and tooling: Kotlin has a vibrant and active community of developers, which means that there are plenty of unofficial resources, libraries, and tools available to help with Android development.

Summary

In this chapter, we learned about the Kotlin programming language and its features. We explored the Kotlin features that are useful for Android development and why it’s important to Android developers. Additionally, we covered how to migrate from Java to Kotlin and some useful tips for developers coming from Java backgrounds.

In the next chapter, we’ll learn how to create Android apps with Android Studio. We will explore some of the features that Android Studio offers and learn some tips and shortcuts.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Apply best practices and industry-essential skills used by Google Developer Experts
  • Find out how to publish, monitor, and improve your app metrics on the Google Play Store
  • Learn how to debug issues, detect leaks, inspect network calls, and inspect your app’s local database
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Written with the best practices, this book will help you master Kotlin and use its powerful language features, libraries, tools, and APIs to elevate your Android apps. As you progress, you'll use Jetpack Compose and Material Design 3 to build UIs for your app, explore how to architect and improve your app architecture, and use Jetpack Libraries like Room and DataStore to persist your data locally. Using a step-by-step approach, this book will teach you how to debug issues in your app, detect leaks, inspect network calls fired by your app, and inspect your Room database. You'll also add tests to your apps to detect and address code smells. Toward the end, you’ll learn how to publish apps to the Google Play Store and see how to automate the process of deploying consecutive releases using GitHub actions, as well as learn how to distribute test builds to Firebase App Distribution. Additionally, the book covers tips on how to increase user engagement. By the end of this Kotlin book, you’ll be able to develop market-ready apps, add tests to their codebase, address issues, and get them in front of the right audience.

Who is this book for?

If you’re an aspiring Android developer or an Android developer working with Java, then this book is for you. Basic Java programming skills are a must if you want to fully utilize the techniques and best practices showcased in this book.

What you will learn

  • Build beautiful, responsive, and accessible UIs with Jetpack Compose
  • Explore various app architectures and find out how you can improve them
  • Perform code analysis and add unit and instrumentation tests to your apps
  • Publish, monitor, and improve your apps in the Google Play Store
  • Perform long-running operations with WorkManager and persist data in your app
  • Use CI/CD with GitHub Actions and distribute test builds with Firebase App Distribution
  • Find out how to add linting and static checks on CI/CD pipelines
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 05, 2024
Length: 370 pages
Edition : 1st
Language : English
ISBN-13 : 9781837631711
Vendor :
JetBrains
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Sweden

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Apr 05, 2024
Length: 370 pages
Edition : 1st
Language : English
ISBN-13 : 9781837631711
Vendor :
JetBrains
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 141.97
Mastering Kotlin for Android 14
€29.99
Kotlin Design Patterns and Best Practices
€33.99
How to Build Android Apps with Kotlin
€77.99
Total 141.97 Stars icon
Banner background image

Table of Contents

21 Chapters
Part 1: Building Your App Chevron down icon Chevron up icon
Chapter 1: Get Started with Kotlin Android Development Chevron down icon Chevron up icon
Chapter 2: Creating Your First Android App Chevron down icon Chevron up icon
Chapter 3: Jetpack Compose Layout Basics Chevron down icon Chevron up icon
Chapter 4: Design with Material Design 3 Chevron down icon Chevron up icon
Part 2: Using Advanced Features Chevron down icon Chevron up icon
Chapter 5: Architect Your App Chevron down icon Chevron up icon
Chapter 6: Network Calls with Kotlin Coroutines Chevron down icon Chevron up icon
Chapter 7: Navigating within Your App Chevron down icon Chevron up icon
Chapter 8: Persisting Data Locally and Doing Background Work Chevron down icon Chevron up icon
Chapter 9: Runtime Permissions Chevron down icon Chevron up icon
Part 3: Code Analysis and Tests Chevron down icon Chevron up icon
Chapter 10: Debugging Your App Chevron down icon Chevron up icon
Chapter 11: Enhancing Code Quality Chevron down icon Chevron up icon
Chapter 12: Testing Your App Chevron down icon Chevron up icon
Part 4: Publishing Your App Chevron down icon Chevron up icon
Chapter 13: Publishing Your App Chevron down icon Chevron up icon
Chapter 14: Continuous Integration and Continuous Deployment Chevron down icon Chevron up icon
Chapter 15: Improving Your App Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(8 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




ProBuyer Oct 03, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I rarely find the time to read a book cover-to-cover but I made time to read this entire book. This is the perfect book to get you quickly up to speed on the latest Kotlin/Android topics, especially Jetpack Compose. It hits on every topic you would need to know to be a great Android developer using the latest Android frameworks and tools. I found it best to reference the official Android documentation while reading this book to dive deeper into certain topics as there is no way to fit all that information into one book. I definitely recommend this book!
Amazon Verified review Amazon
Amazon Customer May 15, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book contains anything needed for developers who are looking to learn or advance their development skill by reading or applying what they are learning. I have been a developer for more than 10 years and I can assure you that if a new person or a developer with experience reads and applies the knowledge found from this book, they will be able to get in line with the latest technology developers are using in the field the moment I posted this comment.This is a good book to read. I like to follow the reading and while I read I also apply what I get from the reading just as it. Developers can do the same with this book and later apply the knowledge to their real life project.
Amazon Verified review Amazon
NavSingh Apr 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
You should check out this book if you are interested in improving your Android app development skills- I enjoyed Harun's book on Android application development.- The book covers almost all the major topics, including design, best practices, and publishing on the app store.- You can use this book whether you're an experienced developer, a seasonal employee, or a junior developer.- With a little knowledge of Java, this book will help you get started learning Kotlin app development.
Amazon Verified review Amazon
Pavan Vulisetti May 28, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Harun Wangereka's "Mastering Kotlin for Android 14" is a must-read for Android developers eager to leverage Kotlin and the latest Jetpack libraries, including Jetpack Compose. This book excels in providing a clear, structured, and hands-on approach to building robust Android applications from scratch. Wangereka's expertise shines through as he guides readers from the basics of Kotlin to advanced topics such as MVVM architecture and performance optimization. The book's practical examples and exercises reinforce learning and ensure that developers can implement the concepts effectively. Staying current with Android 14 updates, it equips readers with modern techniques and best practices, making it a comprehensive resource for both beginners and experienced developers. Wangereka’s engaging writing and thorough coverage make "Mastering Kotlin for Android 14" an invaluable tool for mastering Android app development. Highly recommended for anyone looking to create powerful, efficient, and modern Android applications.
Amazon Verified review Amazon
_' May 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book to accelerate your learnings in Kotlin Android development.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela