- Ваши идеи. Наши технологии. Для миллиардов пользователей
- Масштабирование
- Итерации
- Статистика
- Что нового в Google Play
- Создавайте качественные приложения и игры
- Отчеты о тестировании
- Android Vitals
- Будьте уверены в своем продукте
- Страница приложения
- Обзор выпусков
- Интересные приложения для Android с открытым исходным кодом
- 1. Android-приложение с MVP архитектурой
- 2. Android-приложение с MVVM архитектурой
- 3. Google I/O Android-приложение
- 4. Чертежи архитектуры Google Android
- 5. Telegram
- 6. Plaid
- 7. Wire
- 8. Андроид-приложение ribot
- 9. Kickstarter
- 10. PocketHub
- 11. Простое андроид-приложение с MVP
- Integrating Google Sign-In into Your Android App
- Before you begin
- Configure Google Sign-in and the GoogleSignInClient object
- Check for an existing signed-in user
- Add the Google Sign-in button to your app
- Start the sign-in flow
- Google code android apps
- Try Sign-In for Android
- Get the project
- Configure a Google API project
- Run the sample
- How it works
- Next steps
Ваши идеи. Наши технологии. Для миллиардов пользователей
Масштабирование
Развивайте свой бизнес по всему миру, используя нашу платформу.
Итерации
Проводите эксперименты и тестирования, чтобы подготовить приложение для запуска и дальнейшего использования.
Статистика
Используйте детальную информацию и данные, имеющие практическое значение, чтобы принимать правильные решения.
Что нового в Google Play
Рассказываем новости с Саммита для разработчиков Android. Узнайте о новых функциях и инструментах, которые помогут вам добиться успеха на нашей платформе.
Создавайте качественные приложения и игры
Хотите добиться долгосрочного успеха? Повышайте производительность приложения и качество контента, а также улучшайте интерфейс и функции.
Отчеты о тестировании
Выявляйте проблемы, например со стабильностью и производительностью приложения, до того, как они коснутся пользователей.
Android Vitals
Отслеживайте и повышайте производительность своего приложения или игры.
Будьте уверены в своем продукте
Выбирайте подходящую стратегию и пользуйтесь инструментами, которые позволяют публиковать приложения, управлять ими и успешно выводить их на международный рынок.
Страница приложения
Совершенствуйте страницу приложения в Google Play, чтобы завоевать внимание пользователей.
Обзор выпусков
Отслеживайте сборки и управляйте выпусками на всех этапах.
Источник
Интересные приложения для Android с открытым исходным кодом
Используя и изучая приложения с открытым исходным кодом, вы можете научиться, как создавать хорошие приложения самостоятельно.
Ниже перечислены лучшие проекты под Android с открытым исходным кодом. Благодаря им вы сможете узнать массу отличных практик для разработки под Android.
1. Android-приложение с MVP архитектурой
Этот репозиторий содержит приложение, которое реализует архитектуру MVP с использованием Dagger2, GreenDao, RxJava2, Fast-Android-Networking и PlaceholderView.
2. Android-приложение с MVVM архитектурой
Этот репозиторий содержит приложение, которое реализует архитектуру MVVM с использованием Dagger2, GreenDao, RxJava2, Fast-Android-Networking и PlaceholderView.
3. Google I/O Android-приложение
Google I/O — это конференция разработчиков, которая проводится каждый год. На ней представлены сотни демонстраций технологий от разработчиков.
Этот проект — Android-приложение для конференции. Приложение поддерживает устройства под управлением Android 5.0+ и оптимизировано для телефонов и планшетов всех форм и размеров.
4. Чертежи архитектуры Google Android
Платформа Android обладает большой гибкостью, когда организует и архивирует приложение. Эта свобода может привести к приложениям с большими классами. Это может затруднить тестирование, поддержку и расширение.
Архитектура Android Blueprint предназначена для демонстрации возможных способов помочь в решении этих проблем. Этот проект показывает одно и то же приложение, реализованное много раз с использованием различных архитектурных концепций и инструментов.
Вы можете использовать эти образцы как отправную точку для создания собственных приложений. Здесь основное внимание уделяется структуре кода, архитектуре, тестированию. Однако имейте в виду, что существует множество способов создания приложений с этими архитектурами и инструментами. Сосредоточьтесь на своих собственных приоритетах и не слишком увлекайтесь тем, что можно считать каноническими примерами.
5. Telegram
Telegram — это приложение для обмена сообщениями с акцентом на скорость и безопасность. Этот мессенджер супер быстрый, простой и бесплатный. Данный репозиторий содержит официальный исходный код андроид-приложения для Telegram.
6. Plaid
Приложение под Android, которое способно вдохновить своим дизайном, благодаря отличной реализации material design.
7. Wire
Это приложение чата полно картин, фильмов, GIF, музыки, эскизов и других форм мультимедиа. Также оно всегда обеспечивает безопасное сквозное шифрование.
8. Андроид-приложение ribot
Официальное приложение ribot для Android, в котором реализованы архитектура, инструменты и рекомендации, которые команда поддерживает для платформы Android.
9. Kickstarter
Kickstarter — это глобальное сообщество, которое помогает воплощать творческие проекты в жизнь. Изучайте тысячи проектов в области искусства, дизайна, фильмов, игр, музыки и т. д.
10. PocketHub
GitHub отказался поддерживать приложение, поэтому оно было выпущено «в люди» и поддерживается как публичный проект. Сейчас общество активно работают над переизданием этого приложения в Play Маркет. Это приложение станет духовным преемником оригинального приложения.
11. Простое андроид-приложение с MVP
Очень простое приложение, показывающее, как реализовать архитектуру MVP.
Источник
Integrating Google Sign-In into Your Android App
To integrate Google Sign-In into your Android app, configure Google Sign-In and add a button to your app’s layout that starts the sign-in flow.
Before you begin
Configure Google Sign-in and the GoogleSignInClient object
In your sign-in activity’s onCreate method, configure Google Sign-In to request the user data required by your app. For example, to configure Google Sign-In to request users’ ID and basic profile information, create a GoogleSignInOptions object with the DEFAULT_SIGN_IN parameter. To request users’ email addresses as well, create the GoogleSignInOptions object with the requestEmail option.
If you need to request additional scopes to access Google APIs, specify them with requestScopes . For the best user experience, on sign-in, only request the scopes that are required for your app to minimally function. Request any additional scopes only when you need them, so that your users see the consent screen in the context of an action they performed. See Requesting Additional Scopes.
Then, also in your sign-in activity’s onCreate method, create a GoogleSignInClient object with the options you specified.
Check for an existing signed-in user
In your activity’s onStart method, check if a user has already signed in to your app with Google.
If GoogleSignIn.getLastSignedInAccount returns a GoogleSignInAccount object (rather than null ), the user has already signed in to your app with Google. Update your UI accordingly—that is, hide the sign-in button, launch your main activity, or whatever is appropriate for your app.
If GoogleSignIn.getLastSignedInAccount returns null , the user has not yet signed in to your app with Google. Update your UI to display the Google Sign-in button.
Add the Google Sign-in button to your app
Add the SignInButton in your application’s layout:
Optional: If you are using the default sign-in button graphic instead of providing your own sign-in button assets, you can customize the button’s size with the setSize method.
In the Android activity (for example, in the onCreate method), register your button’s OnClickListener to sign in the user when clicked:
Start the sign-in flow
In the activity’s onClick method, handle sign-in button taps by creating a sign-in intent with the getSignInIntent method, and starting the intent with startActivityForResult .
Starting the intent prompts the user to select a Google account to sign in with. If you requested scopes beyond profile , email , and openid , the user is also prompted to grant access to the requested resources.
After the user signs in, you can get a GoogleSignInAccount object for the user in the activity’s onActivityResult method.
The GoogleSignInAccount object contains information about the signed-in user, such as the user’s name.
You can also get the user’s email address with getEmail , the user’s Google ID (for client-side use) with getId , and an ID token for the user with getIdToken . If you need to pass the currently signed-in user to a backend server, send the ID token to your backend server and validate the token on the server.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Источник
Google code android apps
Google I/O Android App
Due to global events, Google I/O 2020 was canceled and Google I/O 2021 is an online-only event, so the companion app hasn’t been updated since 2019. However, the iosched team has continued adding several architecture improvements to its codebase. The general look and feel of the app is unchanged, and the app still uses the data from Google I/O 2019.
Major improvements implemented in 2021:
- Migration from LiveData to Kotlin Flows to observe data.
- Support for large screens and other form factors.
- Migration from SharedPreferences to Jetpack DataStore.
- (Experimental) Partial migration to Jetpack Compose (in the compose branch)
Google I/O is a developer conference with several days of deep technical content featuring technical sessions and hundreds of demonstrations from developers showcasing their technologies.
This project is the Android app for the conference.
Running the app
The project contains a staging variant that replaces some modules at compile time so they don’t depend on remote services such as Firebase. This allows you to try out and test the app without the API keys.
The app displays a list of conference events — sessions, office hours, app reviews, codelabs, etc. — and allows the user to filter these events by event types and by topics (Android, Firebase, etc.). Users can see details about events, and they can star events that interest them. Conference attendees can reserve events to guarantee a seat.
Other features include a Map of the venue, informational pages to guide attendees during the conference in Info, and time-relevant information during the conference in Home.
The app is written entirely in Kotlin and uses the Gradle build system.
To build the app, use the gradlew build command or use «Import Project» in Android Studio. Android Studio Arctic Fox or newer is required and may be downloaded here.
The architecture is built around Android Architecture Components and follows the recommendations laid out in the Guide to App Architecture. Logic is kept away from Activities and Fragments and moved to ViewModels. Data is observed using Kotlin Flows and the Data Binding Library binds UI components in layouts to the app’s data sources.
The Repository layer handles data operations. IOSched’s data comes from a few different sources — user data is stored in Cloud Firestore (either remotely or in a local cache for offline use), user preferences and settings are stored in DataStore, conference data is stored remotely and is fetched and stored in memory for the app to use, etc. — and the repository modules are responsible for handling all data operations and abstracting the data sources from the rest of the app.
A lightweight domain layer sits between the data layer and the presentation layer, and handles discrete pieces of business logic off the UI thread. See the .\*UseCase.kt files under shared/domain for examples.
The Navigation component is used to implement navigation in the app, handling Fragment transactions and providing a consistent user experience.
Room is used for Full Text Search using Fts4 to search for a session, speaker, or codelab.
UI tests are written with Espresso and unit tests use Junit4 with Mockito when necessary.
The Jetpack Benchmark library makes it easy to benchmark your code from within Android Studio. The library handles warmup, measures your code performance, and outputs benchmarking results to the Android Studio console. We added a few benchmark tests around critical paths during app startup — in particular, the parsing of the bootstrap data. This enables us to automate measuring and monitoring initial startup time. Here is an example from a benchmark run:
Dependency Injection is implemented with Hilt. For more details on migrating from dagger-android to Hilt, read the (migration article.
ViewPager2 offers enhanced functionality over the original ViewPager library, such as right-to-left and vertical orientation support. For more details on migrating from ViewPager to ViewPager2, please see this migration guide.
The app makes considerable use of the following Firebase components:
- Cloud Firestore is our source for all user data (events starred or reserved by a user). Firestore gave us automatic sync and also seamlessly managed offline functionality for us.
- Firebase Cloud Functions allowed us to run backend code. The reservations feature heavily depended on Cloud Functions working in conjuction with Firestore.
- Firebase Cloud Messaging let us inform the app about changes to conference data on our server.
- Remote Config helped us manage in-app constants.
For 2020, the implementation was migrated to the Firebase Kotlin extension (KTX) libraries to write more idiomatic Kotlin code when calling Firebase APIs. To learn more, read this Firebase blog article on the Firebase KTX libraries.
The app is entirely written in Kotlin and uses Jetpack’s Android Ktx extensions.
Asynchronous tasks are handled with coroutines. Coroutines allow for simple and safe management of one-shot operations as well as building and consuming streams of data using Kotlin Flows.
All build scripts are written with the Kotlin DSL.
Источник
Try Sign-In for Android
Use our Android sample app to see how Sign-In works, or add Sign-In to your existing app.
Get the project
If this is your first time using a Google services sample, check out the google-services repository.
Open Android Studio.
Select File > Open, browse to where you cloned the google-services repository, and open google-services/android/signin .
Configure a Google API project
To use the sample, you need to provide some additional information to finish setting up your project. Click the button below, and specify the package name com .google .samples .quickstart .signin when prompted. You will also need to provide the SHA-1 hash of your signing certificate. See Authenticating Your Client for information.
The sample’s IdTokenActivity and ServerAuthCodeActivity examples require you to specify an OAuth 2.0 web client ID. In a real app, this client ID would represent your app’s backend server. A client ID for this purpose was created when you configured the project above.
Find this value by opening the Google API Console:
Your web server client ID is displayed next to Web client (Auto-created for Google Sign-in). Copy and paste the client ID into your project’s strings.xml file:
Run the sample
Now you’re ready to build the sample and run it from Android Studio.
Build the sample and click the run button and select a connected device or emulator with the latest version of Google Play services.
How it works
The application builds a GoogleSignInClient , specifying the sign-in options it needs. Then, when the sign-in button is clicked, the application starts the sign-in intent, which prompts the user to sign in with a Google account.
Next steps
If you want to see how you can implement Google Sign-In in your own app, take a look at our implementation guide.
Did you have a good experience? Run into trouble? Let us know!
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Источник