Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lawrence_shaun_introducing_net_maui_build_and_deploy_crosspl.pdf
Скачиваний:
46
Добавлен:
26.06.2023
Размер:
5.15 Mб
Скачать

Chapter 14 Releasing Our Application

times during the time it has taken to write this book. For this reason alone, I will defer to the platform providers and Microsoft’s documentation on how to achieve distribution. What this chapter will cover is details around distributing applications, why you need to do it, and some of the common issues that crop up during the process.

One very important thing to note is that apps built with .NET MAUI follow the same rules and common issues that native applications follow. Therefore, when encountering issues with each specific store, sometimes a search engine will return better results if you omit the

.NET MAUI part.

Android

Android has the biggest mobile user base. However, given the model it follows of allowing manufacturers to customize the Android operating system as well as providing varying sets of hardware, it can be the most problematic.

An Android Package, or APK for short, is the resulting application file that runs on an Android device. If you wish to provide a mechanism to download this file (e.g., a website or file share), users can side load the application onto their Android device. This is not recommended in the public domain because it can be very difficult to trust the packages that are freely downloaded from the Internet.

When you wish to distribute using the Google Play Store, you are required to build an Android App Bundle, or AAB for short. It contains all of the relevant files needed to compile an APK ready for installation on a user’s device.

410

Chapter 14 Releasing Our Application

Essentially you build an Android App Bundle, sign it with a specific signing key that you own, and upload the bundle to Google Play. Google uses this bundle when a user comes to download your application and compiles a specific APK for that device. This is the way to do things now. If you have worked with Android apps in the past, you may recall building the APK yourself. This runs into the issue that the APK is architecture-­ specific, and in the current market where there are multiple architectures supported by the various Android devices, you can end up with an application size that is the sum of the number of architectures multiplied by the actual size (for example, if there are four architectures and the application size is 25MB, the resulting APK is 100MB).

Additional Resources

Both Microsoft and Google provide documentation on how to distribute applications via the Google Play Store. See the following links.

•\ Microsoft: How to publish an application ready for the Play Store, https://learn.microsoft.com/dotnet/ maui/android/deployment/overview

•\ Google: How to upload your application to the Play Store, https://developer.android.com/studio/ publish/upload-bundle

•\ It is also worth noting that other stores/platforms provide the ability to distribute, install, and run Android applications. Amazon devices such as the Kindle Fire are built on top of Android and allow the running of Android applications. Amazon provides its own store, details of which can be found at ­https:// developer.amazon.com.

411

Chapter 14 Releasing Our Application

iOS

iOS and macOS are considered really painful when dealing with distributing and signing. Having spent several years going through this pain, I want to break down the key concepts to hopefully reduce the pain that you might experience. Thankfully the Apple tooling has come a long way since I started building mobile apps in 2007, so you don’t have to relive all those painful memories.

The following sections cover the development and application settings you will need to create on the Apple developer website at https:// developer.apple.com.

Certificate

You need to generate a certificate on the machine that will build your application. Most documentation takes you through the complex scenarios of creating a Certificate Signing Request and then uploading to Apple. There is actually a far simpler way by using Xcode. The following steps can help to achieve this:

•\

Click the Xcode main menu.

•\

Click on Settings.

•\

Click on the Accounts tab.

•\

Click the Manage Certificates button, shown in

 

Figure 14-1.

412

Chapter 14 Releasing Our Application

Figure 14-1.  Apple settings screen showing how to manage certificates

Identifier

This represents your application. It requires you to define unique details to identify the application that will be exposed to the public store as well as defining what capabilities your application requires.

Capabilities

iOS applications run under a sandboxed environment. Apple provides a set of App Services that can be utilized by your applications and enhance its capabilities. Capabilities include services like in-app purchasing, push notifications, Apple Pay, and such. The use of these services needs to be defined at compile time and the usage of them will be reviewed when you upload your application to Apple for review. Therefore, it’s important that you make sure you only have the ones you need. Don’t worry, though; a

413