- Accessing Google Cloud Storage From Android OAuth2
- how to uploading image from android device to Google cloud storage?
- 2 Answers 2
- Создание проекта в Google Cloud Console
- Создание проекта
- Консоль
- gcloud
- Настройка оплаты
- Включение API
- Консоль
- Cloud SDK
- Просмотр включенных API
- Консоль
- gcloud
- Управление оплатой
- Настройка бюджетов и оповещений об их превышении
- Консоль
- gcloud
- Удаление проекта
- Консоль
- gcloud
- Что дальше
- How can I use Google Cloud speech API from Android?
- 3 Answers 3
- Safely back up your files
- Sync Google Drive with your computer
- Get Drive Everywhere
- Download Backup and Sync for Windows
- Download Backup and Sync for Mac
- Google Drive Terms of Service
Accessing Google Cloud Storage From Android OAuth2
I am trying to design an app which downloads the appropriate sound files from my Google cloud storage account. The app does not access the users account but my own.
My reading has led me to believe that the most appropriate model is The Service account https://code.google.com/p/google-api-java-client/wiki/OAuth2#Service_Accounts
Unfortunately the developers have decided not to provide an example with Android. They do provide a nice example with just plain Java, which works http://samples.google-api-java-client.googlecode.com/hg/storage-serviceaccount-cmdline-sample/instructions.html?r=default
I tried to adapt this for Android and have run into problems.
In Google’s example they pass the key.p12 file , However on Android when I put the file in the res/raw folder it seems the only way I have of accessing it is as an input stream. I can’t find an elegant way to get a file to pass to JSON.
This all leads me to believe I must be doing something wrong. Should I be using the key.p12 Should I be using the «service account model». Is there an example out there /
An Update I managed to achieve my goal of getting it to work but my solution feels clunky to me and I am sure it is not the way intended
What I did was add the key.p12 as a raw/resource which I opened as as input stream. Which I then converted to the private key using the libraries as seen in the example.
My code looks like this
But the whole thing is ugly and I would like a cleaner solution
Источник
how to uploading image from android device to Google cloud storage?
I developed an android app which use Google app engine as a server and it works fine . Now i want to upload image from my device to google cloud storage and retrieve from storage to my device. I had read many blogs on internet about google cloud storage and data store but i am not getting how it can be implemented in android.
2 Answers 2
For android, it’s recommended that you use Firebase Storage to ease the process.
Firebase Storage stores your files in a Google Cloud Storage bucket shared with the default Google App Engine app, making them accessible through both Firebase and Google Cloud APIs.
Implementation path:
Integrate the Firebase Storage SDKs. Quickly include clients via Gradle, CocoaPods, or a script include.
Create a Reference. Reference the path to a file, such as «images/mountains.png», to upload, download, or delete it.
Upload or Download. Upload or download to native types in memory or on disk.
Secure your Files. Use Firebase Storage Security Rules to secure your files.
You can choose Google Cloud Storage or Firebase. For both products, Google gives client libraries for Java Clients.
I find firebase easy and more intuitive to use. You can build the solution faster and better with Firebase.
I faced issues while using Google Cloud Storage APIs and worst, in my experience no one replies to your queries when you post queries about Google Cloud Storage. Support for Google Cloud Storage is absolutely pathetic compared to what I have seen for AWS or Cloudinary. You will experience better developer support for Firebase too.
On the flip side, at present Firebase is costlier than Google Cloud Storage.
Источник
Создание проекта в Google Cloud Console
В этом руководстве показано, как создать проект Google Cloud, чтобы начать использовать API, доступные на платформе Google Карт. Часть этих инструкций также приводится на странице Начало работы с платформой Google Карт, но мы рекомендуем прочитать эту статью целиком, поскольку она поможет вам в управлении проектами.
Создание проекта
Чтобы управлять сервисами, учетными данными, оплатой, а также использовать API и SDK на платформе Google Карт, необходимо создать проект.
Оплату сервисов требуется настроить для каждого проекта, однако она будет взиматься только в случае превышения бесплатной квоты.
Чтобы создать проект Google Cloud с включенной оплатой, выполните следующие действия:
Консоль
Создайте проект Google Cloud в Cloud Console.
Заполните обязательные поля на странице Создание проекта.
Название проекта. Используйте название по умолчанию или введите собственное.
Вы можете изменить название проекта в любой момент. Подробная информация приведена в разделе об идентификации проектов.
Идентификатор проекта. Используйте вариант по умолчанию или нажмите Изменить, чтобы указать собственный идентификатор, который API Google будут использовать для определения вашего проекта.
Идентификатор проекта нельзя изменить после создания проекта. Поэтому важно сразу выбрать подходящий вариант, так как он будет связан с проектом на протяжении всего периода его действия. Идентификатор проекта не должен содержать конфиденциальную информацию.
Платежный аккаунт. Выберите платежный аккаунт для проекта. Если у вас только один платежный аккаунт или его нет вообще, этот пункт не будет отображаться на странице.
У вас должна быть роль администратора платежного аккаунта или менеджера управления оплатой в проекте, чтобы связать этот проект с платежным аккаунтом. Подробная информация приведена в этой документации.
Местоположение. Если вы хотите привязать к проекту организацию, нажмите Обзор. Вы также можете выбрать вариант «Без организации».
Нажмите Создать.
gcloud
Прочитайте статьи о Google Cloud SDK, установке Cloud SDK и следующих командах:
Настройка оплаты
Чтобы развернуть приложение, необходимо включить оплату, однако она будет взиматься только в случае превышения бесплатной квоты. То есть вы будете платить только за не покрываемые квотой дополнительные ресурсы, если они понадобятся для работы вашего приложения.
Если у вас уже есть платежный аккаунт, он будет автоматически связан с созданным проектом.
Чтобы включить оплату для проекта Google Cloud, выполните следующие шаги:
В Cloud Console перейдите на страницу «Оплата».
Выберите или создайте проект Google Cloud.
Информация, которую вы увидите на странице «Оплата», зависит от того, есть ли у вас платежный аккаунт и связан ли он с выбранным проектом Google Cloud:
Если для выбранного проекта Google Cloud уже включена оплата, на странице отображаются сведения о платежном аккаунте.
Если у вас нет платежного аккаунта, вам будет предложено создать его и связать с проектом.
Если у вас есть платежный аккаунт, но он не связан с проектом, вам будет предложено включить оплату. Вы также можете нажать Отмена, а затем – Создать аккаунт, чтобы создать новый платежный аккаунт и связать с проектом его.
Учтите, что ограничений на сумму оплаты нет. Чтобы контролировать расходы, укажите бюджет и настройте оповещения о его превышении. Подробнее о настройке оплаты…
Включение API
Для работы с платформой Google Карт вам потребуется включить API и SDK, которые будут использоваться в проекте.
Консоль
Cloud SDK
Прочитайте статьи о Google Cloud SDK, установке Cloud SDK и следующих командах:
Просмотр включенных API
Консоль
Чтобы посмотреть список включенных API и SDK, перейдите на страницу «Платформа Google Карт» в Cloud Console.
Перейти на страницу «Платформа Google Карт»
- Дополнительные API – это API и SDK, которые можно включить.
- Если вы видите карточки для API и сервисов Google Карт, это значит, что API и SDK не были включены.
gcloud
Прочитайте статьи о Google Cloud SDK, установке Cloud SDK и следующих командах:
Управление оплатой
Выберите проект в Cloud Console.
В разделе «Оплата» можно выполнить следующие действия:
- посмотреть сведения о платежном аккаунте, перевести средства и добавить администраторов аккаунта на странице Обзор (чтобы в вашей команде всегда был специалист с нужными полномочиями, создайте сразу несколько владельцев проекта и администраторов платежного аккаунта);
- указать бюджет и настроить оповещения на странице Бюджеты и оповещения;
- просмотреть историю транзакций и скачать счета на странице Транзакции;
- скачать данные об оплате на странице Экспорт отчета о платежах;
- настроить платежный аккаунт и указать контактную информацию на странице Настройки платежей;
- указать способ оплаты на странице Способ оплаты.
Настройка бюджетов и оповещений об их превышении
Вы можете указать бюджет, включить оповещения и отслеживать все платежи, связанные с проектами Google Cloud, чтобы избежать непредвиденных расходов. Оповещения будут отправляться администраторам ваших платежных аккаунтов по электронной почте в случае превышения указанной суммы.
Консоль
Чтобы настроить бюджет и оповещения о его превышении для проекта Google Cloud, выполните следующие действия:
В Cloud Console перейдите на страницу «Оплата».
Перейти на страницу «Оплата»
gcloud
Включите нужный API, чтобы задать бюджет для оплаты.
Укажите бюджет, чтобы получать оповещение, когда фактические расходы достигнут 50 % от этой суммы и когда прогнозируемые расходы достигнут 75 % от нее.
Прочитайте статьи о Google Cloud SDK, установке Cloud SDK и следующих командах:
Удаление проекта
Чтобы отключить оплату и ресурсы, используемые для проекта Google Cloud, необходимо удалить проект. Для этого выполните следующие действия:
Консоль
Перейдите на страницу «Проекты».
Выберите проект Google Cloud, который вы хотите закрыть, и нажмите Удалить.
Подробная информация об управлении проектами Google Cloud доступна на странице Cloud Resource Manager: создание, удаление и восстановление проектов.
gcloud
Прочитайте статьи о Google Cloud SDK, установке Cloud SDK и следующих командах:
Что дальше
После настройки проекта Google Cloud необходимо создать и защитить ключ API, чтобы начать использовать Maps SDK для Android.
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.
Источник
How can I use Google Cloud speech API from Android?
I have a college project and I’m developing an Android Application that acts like a translator. For normal text translation I’m using Google Cloud Translation API and I saw they have an option to translate text via speech using Google Cloud speech API. Problem is I don’t have a starting point, and I didn’t understand how can I use it.
So, is there an example of how can I use Google Cloud speech API from my Android application?
3 Answers 3
Android runs Java examples just fine. You can find them on github.
You can also use Android Speech API, it is free, unlike Google Cloud Speech API.
Yes it is possible, I have done it, based on Googles «speech» example inside «android-docs-samples-master» (google and download those samples). Things you need to know:
- You will need to setup a free Google Cloud account, and activate billing. BILLING? WTF DO I NEED TO PAY? Hold on. keep reading my answer!!
- The first 60min of speech recognition time of EVERY month are FREE.
- Setting up billing and obtaining the PREF_ACCESS_TOKEN_VALUE value you need to add to your SpeechRecognizer class requires patience, remember. You also need to obtain an authentication json from google and add it to the «res -> raw» folder of you project.
- The speech demo is not well suited for fast consecutive ASR requests, as shutting down the speech recognition service takes 2-6 seconds (I am working on this).
UPDATE: If you got this working, you might have noticed that the 3rd or 4th time you do ASR, it fails. This is because the sample code is not designed to close and open the entire ASR recognizer properly. I got it working, if you need help on a specific error let me know. This is a summarized guide, if you need more details on a particular step let me know.
Источник
Safely back up your files
Upload and store files from any folder on your computer, camera, and SD cards in the cloud. You can find your content on any phone, tablet, or computer using Google Drive, and your photos and videos in Google Photos.
G Suite customer? Learn about Drive File Stream.
There is no Drive app for Linux at this time. Please use Drive on the web and on your mobile devices.
Sync Google Drive with your computer
Browse and view files from drive.google.com in the Google Drive folder on your computer.
Open, organize, and make changes to any of your files.
Any changes you make to files will sync everywhere.
Get Drive Everywhere
Add files to Drive from your Mac and they sync with your other devices — automatically.
Download Backup and Sync for Windows
Download Backup and Sync for Mac
Google Drive Terms of Service
By using Backup and Sync, you agree to the Google Terms of Service. If you are a Google Apps user, your use is subject to either the appropriate Google Apps Terms of Service, or the negotiated Google Apps terms, if applicable.
By using Google Drive, you agree to the Google Terms of Service. If you are a Google Apps user, your use is subject to either the appropriate Google Apps Terms of Service, or the negotiated Google Apps terms, if applicable.
Источник