GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing azure.github.io — Android Guidelines: Implementation | Azure SDKs Android Guidelines: ImplementationAPI ImplementationThis section describes guidelines for implementing Azure SDK client libraries. Please note that some of these guidelines are automatically enforced by code generation tools. ⛔️ DO NOT allow implementation code (that is, code that doesn’t form part of the public API) to be mistaken as public API. There are two valid arrangements for implementation code, which in order of preference are the following:
CheckStyle checks ensure that classes within an Service ClientAsync Service Client✅ DO include blocking calls inside async client library code. Using the HTTP PipelineThe Azure SDK team has provided an Azure Core library that contains common mechanisms for cross cutting concerns such as configuration and doing HTTP requests. ✅ DO use the HTTP pipeline component within Azure Core for communicating to service REST endpoints. The HTTP pipeline consists of a HTTP transport that is wrapped by multiple policies. Each policy is a control point during which the pipeline can modify either the request and/or response. We prescribe a default set of policies to standardize how client libraries interact with Azure services. The order in the list is the most sensible order for implementation. ✅ DO include the following policies provided by Azure Core when constructing the HTTP pipeline:
☑️ YOU SHOULD use the policy implementations in Azure Core whenever possible. Do not try to “write your own” policy unless it is doing something unique to your service. If you need another option to an existing policy, engage with the Architecture Board to add the option. AnnotationsInclude the following annotations on the service client class. For example, this code sample shows a sample class demonstrating the use of these two annotations:
Service Client BuilderAnnotationsThe This builder states that it can build instances of Supporting TypesModel TypesAnnotationsThere are two annotations of note that should be applied on model classes, when applicable:
SDK Feature ImplementationConfigurationWhen configuring your client library, particular care must be taken to ensure that the consumer of your client library can properly configure the connectivity to your Azure service both globally (along with other client libraries the consumer is using) and specifically with your client library. For Android applications, configuration can be applied in a variety of ways, such as through application preferences or using a
LoggingClient libraries must make use of the robust logging mechanisms in Azure Core, so that the consumers can adequately diagnose issues with method calls and quickly determine whether the issue is in the consumer code, client library code, or service. Request logging will be done automatically by the ✅ DO follow the logging section of the Azure SDK General Guidelines and the following guidelines if logging directly (as opposed to through the Using the ClientLogger interface✅ DO use the
✅ DO create a new instance of a Don’t create static logger instances. Static logger instances are long-lived and the memory allocated to them is not released until the application is terminated. ✅ DO throw all exceptions created within the client library code through one of the logger APIs - For example: Distributed tracingDistributed tracing is uncommon in a mobile context. If you feel like you need to support distributed tracing, contact the Azure SDK mobile team for advice. TestingOne of the key things we want to support is to allow consumers of the library to easily write repeatable unit-tests for their applications without activating a service. This allows them to reliably and quickly test their code without worrying about the vagaries of the underlying service implementation (including, for example, network conditions or service outages). Mocking is also helpful to simulate failures, edge cases, and hard to reproduce situations (for example: does code work on February 29th). ✅ DO parameterize all applicable unit tests to make use of all available HTTP clients and service versions. Parameterized runs of all tests must occur as part of live tests. Shorter runs, consisting of just Netty and the latest service version, can be run whenever PR validation occurs.
Other Android-related considerations
Android developers need to concern themselves with the runtime environment they are running in. The Android ecosystem is fragmented, with a wide variety of runtimes deployed. ✅ DO support at least Android API level 15 and later (Ice Cream Sandwich). This value can be found in your project’s top level There are two things that are of concern when discussing the minimum API level to choose:
We require the minimum API level that Google supports that reaches the most Android devices while still allowing for the use of widely adopted tools by the developer community, such as popular HTTP clients or serialization libraries. We have currently landed on API level 15, which covers more than 99.8% of all Android devices (as of May 2021). The reach of a particular API level can be found when clicking “Help me choose” in Android Studio’s “Create New Project” screen, after selecting the type of project to create. ✅ DO set the As of November 2018, all existing Android apps are required to target API level 26 or higher. For more information, see Improving app security and performance on Google Play for years to come. ✅ DO set the ✅ DO set your Gradle project’s source and target compatibility level to ✅ DO release the library as an Android AAR. ✅ DO define a ☑️ YOU SHOULD include a Proguard configuration in the AAR to assist developers in correctly minifying their applications when using the library. ✅ DO use | |||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |