我正在创建一个应用程序,要求用户从他们的云端硬盘中选择一个文件夹。我正在努力设置 Picker API。
按照本文档,我使用他们的“Hello World”脚本设置了我的项目,但是在更改了“devlopedKey”和“clientID”之后,我测试了代码以接收错误:
错误 401,invalid_client,没有注册的来源。
在四处搜索后,我发现了将客户端凭据中的 Authorized JavaScript origin 设置为http://localhost:8888 的建议。这样做后,我收到一个不同的错误:
错误 400,origin_mismatch
对不起,如果这是我的一个简单错误,任何帮助将不胜感激。
I'm creating an app that uses Google's Geolocation API, as documented here.
As part of the POST request I need to send to their API, I need to include The mobile radio type, radioType. The question of how to receive that has already been asked and answered here.
My question is as follows:
telephoneManager.getNetworkType()我显然应该使用的函数返回 18 个值之一,在此处记录为常量。
这是否意味着radioTypeGoogle 的地理定位 API 所描述的真的可以是 18 个不同的值?因此,如果事实证明我的无线电类型不是他们支持的四种类型(GSM、LTE、CDMA 或 WCDMA)之一,那么我只是运气不好,将不得不因不包括radioType在我的请求中而损失准确性?
我有一种感觉,我正在混淆这些术语radio type,network …
我正在将 python 客户端库用于 Google Storage API,并且我有一个文件 pythonScript.py,其中包含以下内容:
# Imports the Google Cloud client library
from google.cloud import storage
# Instantiates a client
storage_client = storage.Client()
# The name for the new bucket
bucket_name = 'my-new-bucket'
# Creates the new bucket
bucket = storage_client.create_bucket(bucket_name)
print('Bucket {} created.'.format(bucket.name))
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我在终端中得到了这个:
回溯(最近一次调用):文件“pythonScript.py”,第 11 行,存储桶 = storage_client.create_bucket(bucket_name) 文件“/home/joel/MATI/env/lib/python3.5/site-packages/google/ cloud/storage/client.py”,第 218 行,在 create_bucket bucket.create(client=self) 文件中“/home/joel/MATI/env/lib/python3.5/site-packages/google/cloud/storage/bucket .py”,第 199 行,在 create data=properties, _target_object=self) 文件“/home/joel/MATI/env/lib/python3.5/site-packages/google/cloud/_http.py”,第 293 行,在 api_request 中引发 exceptions.from_http_response(response) google.cloud.exceptions.Conflict: 409 POST https://www.googleapis.com/storage/v1/b?project=avid-folder-180918:抱歉,该名称不可用. 请尝试不同的。
我不知道为什么,因为我确实为我的项目启用了 GSS API,而且默认配置似乎是正确的。的输出 …
我应该将邮件服务从旧项目替换为 GMail。但是,该项目正在使用 PHP,并且在 google 文档页面中还没有关于 PHP 代码的文档。我想测试发送带有简单邮件正文的电子邮件,这是代码:
require_once __DIR__."/google-api-php-client-2.2.1/vendor/autoload.php";
define("APPLICATION_NAME", "Gmail API PHP Quickstart");
define("CREDENTIALS_PATH", "~/.credentials/gmail-php-quickstart.json");
define("CLIENT_SECRET_PATH", __DIR__."/client_secret.json");
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/gmail-php-quickstart.json
define('SCOPES', implode(' ', array(
Google_Service_Gmail::GMAIL_READONLY)
));
date_default_timezone_set('America/New_York'); // Prevent DateTime tz exception
/*
if (php_sapi_name() != 'cli') {
throw new Exception('This application must be run on the command line.');
}
*/
/**
* Returns an authorized API client.
* @return Google_Client the authorized client object
*/
function getClient() { …Run Code Online (Sandbox Code Playgroud) 我是 Python 新手。我想使用 Google 文本到语音转换 API,因为我在下面的代码中使用了它,但由于错误,我无法访问该 API。这是代码,
def synthesize_text(text):
"""Synthesizes speech from the input string of text."""
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
input_text = texttospeech.types.SynthesisInput(text=text)
# Note: the voice can also be specified by name.
# Names of voices can be retrieved with client.list_voices().
voice = texttospeech.types.VoiceSelectionParams(
language_code='en-US',
ssml_gender=texttospeech.enums.SsmlVoiceGender.FEMALE)
audio_config = texttospeech.types.AudioConfig(
audio_encoding=texttospeech.enums.AudioEncoding.MP3)
response = client.synthesize_speech(input_text, voice, audio_config)
# The response's audio_content is binary.
with open('output.mp3', 'wb') as out:
out.write(response.audio_content)
print('Audio content written to file "output.mp3"')
Run Code Online (Sandbox Code Playgroud)
这是错误,
google.auth.exceptions.DefaultCredentialsError: …Run Code Online (Sandbox Code Playgroud) google-api google-authentication python-3.x google-text-to-speech
Google API 到期日期是 1 小时,问题是我使用 API 是为了允许用户使用管理 SDK 功能(列出群组、将成员添加到群组等)
没有人可以在一小时内完成任何一项工作,这将要求用户每天多次登录他们的帐户来管理他们的群组。如果您只想使用 Google 对用户进行身份验证,那么 1 小时的到期日期是不错的选择。
如何增加它或有任何解决方法?我错过了什么吗?
google-api google-api-php-client google-admin-sdk google-php-sdk google-workspace
基于关于如何在 google-cloud-storage 中创建对象的文档(参见https://googleapis.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html 中的“创建”方法),我们应该在尝试上传大文件时使用 blob.writer(...) 方法,因为它可能以某种方式自动处理可恢复的上传。这是正确的吗?
但是,如果我们希望在 SIGNED url 上进行可恢复的上传,那么在 Java 中如何实现呢?(非常感谢任何示例代码或指针;到目前为止,我的研究使我相信使用精心创建的 java 库是不可能的,而是需要使用“PUT”和“自定义构建自己的逻辑” POST”语句生成签名后的 url。这是迄今为止的“最佳”方式吗?)
我有一个使用 Maps API 的应用程序,我有一个 API 的调试和发布密钥。当侧面加载时,这一切都很好。Release 键适用于发布版本。我将发布 APK 上传到 Google Play 控制台并推出了内部测试版本。我从商店安装,它的行为就像 API 密钥不好。
我在网站上遇到了许多类似的问题,甚至尝试在清单中硬编码发布密钥,在所有情况下,它在侧面加载时都可以正常工作,但在通过 Google Play 商店安装时却无法正常工作。
我将手机连接到日志分析器并进行了一些地图操作以尝试查看问题所在,但是我在日志中收到的仅有的两条消息表明 Map API 正在工作,即使我没有显示任何地图并且它就像 API 密钥丢失或无效一样。请注意,当我从标准更改为卫星时发生了弃用警告,我没有直接使用室内支持。加载 Activity 时出现 API 包版本消息。
这是两个日志条目:02-03 09:23:07.550 15809-15809/? W/Google Maps Android API:弃用通知:在未来版本中,卫星、混合或地形类型地图将不再支持室内。即使在不支持室内的情况下,isIndoorEnabled() 也会继续返回通过 setIndoorEnabled() 设置的值,就像现在一样。默认情况下,setIndoorEnabled 为“true”。API 发行说明 ( https://developers.google.com/maps/documentation/android-api/releases ) 会在这些地图类型的室内支持变得不可用时通知您。
02-03 09:30:24.319 15809-15809/? I/Google Maps Android API:Google Play 服务包版本:14799019
我正在使用 Google Signing 并上传了签名密钥,我认为它可能会被双重签名并导致问题。我上传了一个未签名的 APK,Google Play Console 接收了该应用并对其进行了签名。我还上传了签名的 APK,无论哪种情况,地图都是空白的,就像没有密钥或密钥无效一样。在所有情况下,地图在侧面加载时都可以正常工作,即不是通过商店加载,但在通过商店加载时不显示地图。
我正在尝试在我的应用程序中实现 Google 登录,但我不断收到此错误'android.content.Intent com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent()' on a null object reference。
我在这里遵循了来自 firebase 网站的教程 --> https://firebase.google.com/docs/auth/android/google-signin
这是我的代码
private void googleSignIn() {
Intent intent = googleSignInClient.getSignInIntent();
startActivityForResult(intent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(Objects.requireNonNull(account));
} catch (ApiException e) {
Log.w("hhm", "Google signin failed", e);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我一直在为 Google Docs 工作的市场应用程序设置 OAuth。我需要将我的项目使用的范围应用于 OAuth API 。我已经检查了该项目,它使用了 2 个范围
https://www.googleapis.com/auth/documents
https://www.googleapis.com/auth/script.container.ui
Run Code Online (Sandbox Code Playgroud)
我能够应用 google docs API 并找到/auth/documents. 我已经启用了脚本 API,但script.container.ui不是这个库的一部分。我在商店里搜索过,我找不到它。我也找不到任何其他人无法找到它的报告。有谁知道我如何启用这个范围?
google-api ×10
android ×3
email ×1
gmail ×1
google-docs ×1
google-maps ×1
google-oauth ×1
java ×1
php ×1
python-3.x ×1
radio ×1