我正在使用 Google Cloud Messaging API.
在服务器端,我想获取在Google Cloud Messaging提供的项目ID上注册的所有设备的列表.因此,我可以获得所有设备列表,以便我可以将所有这些设备存储到数据库中请给我一个关于我们如何做到这一点的建议.谢谢
我正在使用本机消息传递应用程序.我创建了以下文件
1.C++ conole app 2.JS文件3. manifet文件我已经创建了这样的注册表项 
现在我在行port = chrome.runtime.connectNative(hostName)中收到错误; 我注意到chrome.runtime本身是undefined.let我知道我在这里遗漏了什么.
Manifest.jason
function connect() {
//var m1 = chrome.runtime.getManifest();
var hostName = "NM1";
var t1 = chrome;
appendMessage("Connecting to native messaging host <b>" + hostName + "</b>")
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
updateUiState();
}
Run Code Online (Sandbox Code Playgroud)
main.js
function connect() {
//var m1 = chrome.runtime.getManifest();
var hostName = "NM1";
appendMessage("Connecting to native messaging host <b>" + hostName + "</b>")
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
updateUiState();
}
Run Code Online (Sandbox Code Playgroud) google-api google-apps google-chrome-extension google-chrome-app chrome-native-messaging
我是Google Drive API的新手。我正在将文件从服务器上传到Google Drive。
在我的Gmail帐户中
添加了一个与Google通信的Controller,具体如下:
set_include_path(get_include_path() . PATH_SEPARATOR . ROOT .DS. "vendors");
require_once('Google/Client/Google_Client.php');
require_once('Googl
Run Code Online (Sandbox Code Playgroud)e / Client / contrib / Google_DriveService.php');
define('CLIENT_ID','my_client_here....');
define('SERVICE_ACCOUNT_NAME','my_account_name here');
define('KEY_FILE',VENDORS.'Google/Client/key/privatekey.p12'); // what i was availed by google.
if(is_file(KEY_FILE)){
$client = new Google_Client();
$key = file_get_contents(KEY_FILE);
$client->setClientId(CLIENT_ID);
$client->setAssertionCredentials(new Google_AssertionCredentials(
SERVICE_ACCOUNT_NAME,
array('https://www.googleapis.com/auth/drive'),
$key)
);
$service = new Google_DriveService($client);
$file = new Google_DriveFile();
$file->setTitle('Any sample file title');
$file->setDescription('An experiment to upload text file via server to server');
$file->setMimeType('text/plain');
$data = "Lorem ipsum is …Run Code Online (Sandbox Code Playgroud) 所以我有一个我正在研究的应用程序.我在XAMPP中有一个本地副本,在服务器上有一个实时版本(当然).一切都很好,但是,当我退出一个时,我得到这个错误:
致命错误:在C:\ localhost\htdocs\up\api\src\io\_Google_REST.php中显示错误消息'Google_ServiceException',并显示消息'错误调用GET(401)无效凭据':66堆栈跟踪:#0 C:\ localhost\htdocs\up\api\src\io\Google_REST.php(36):Google_REST :: decodeHttpResponse(Object(Google_HttpRequest))#1 C:\ localhost\htdocs\up\api\src\service\Google_ServiceResource.php(186) ):Google_REST :: execute(Object(Google_HttpRequest))#2 C:\ localhost\htdocs\up\api\src\contrib\Google_Oauth2Service.php(36):Google_ServiceResource - > __ call('get',Array)#3 C :\ localhost\htdocs\up\src\user.php(63):Google_UserinfoServiceResource-> get()#4 C:\ localhost\htdocs\up\includes\authorizedHeader.php(5):require('C:\ localhost\ht ...')#5 C:\ localhost\htdocs\up\profile.php(1):include('C:\ localhost\ht ...')
6 {66}在第66行的C:\ localhost\htdocs\up\api\src\io\Google_REST.php中抛出
我努力刷新,清除缓存等等,我仍然得到错误.但是,当我关闭浏览器并重新打开它时,一切都重新出现,就像没有发生任何事情一样.
有没有人有这个问题/解决了吗?
建议非常感谢.
最好,
泰勒
我在我的Android应用程序中实现了GCM.我有1461位用户注册.我正在使用JSON方法向服务器发送消息.当我尝试发送推送消息时,我得到一个错误
"批量邮件数量(1461)超过允许的最大数量(1000)"
是因为GCM对邮件数量有限制吗?或者它是JSON的问题?
我想创建一个必须访问我的Google日历的简短工具.因此我必须使用google-api-client gem.当我看一下安装的宝石时,我看到了它.
在我可以使用这个提供的类和方法之前,我必须使用clientID和clientSecret以及其他一些东西创建一个YAML文件.因此,gem应该有一个名为"google-api"的cli工具.如果我现在想要创建此文件,我总是收到消息google-api:command not found.
如果这很重要,我会使用rvm.但我已经检查过我是否拥有合适的宝石套装.
(我必须做的一切,我在这里找到:https://developers.google.com/google-apps/calendar/instantiate?hl = de)
我试图将一些JSON转换为android中的java对象,但它似乎不起作用.
Gson gson = new Gson();
Person person = gson.fromJson(s, Person.class);
Toast toast = Toast.makeText(getApplicationContext(), "Welcome back " + person.getDisplayName(), duration);
toast.show();
Run Code Online (Sandbox Code Playgroud)
Person.class的地方
com.google.api.services.plus.model.Person
Run Code Online (Sandbox Code Playgroud)
我收到类型转换错误,例如:
wrong object type: Ljava/lang/Double; Ljava/lang/Integer;
java.lang.IllegalArgumentException: invalid value for field
Run Code Online (Sandbox Code Playgroud)
但是我想从API库中重用这个模型对象,所以无论如何要解决这个问题吗?
编辑:
要以更简单的形式证明此问题,请参阅此示例.
com.google.api.services.plus.model.Person;
Gson g = new Gson();
Person p1 = new Person();
p1.setDisplayName("Test");
p1.setCircledByCount(10);
String json = g.toJson(p1);
Person fromJson = g.fromJson(json, Person.class);
System.out.println(fromJson.getDisplayName());
Run Code Online (Sandbox Code Playgroud)
抛出相同的异常.
Exception in thread "main" java.lang.IllegalArgumentException: Can not set java.lang.Integer field com.google.api.services.plus.model.Person.circledByCount to java.lang.Double
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown …Run Code Online (Sandbox Code Playgroud) 我正在Google API用于渲染YouTube视频.Ißm试图寻找特定时间,seekToMillis()但视频始终从头开始.
码:
youTubePlayerView.initialize(API_KEY, new YouTubePlayer.OnInitializedListener() {
public void onInitializationSuccess(Provider arg0, YouTubePlayer player, boolean arg2) {
youTubePlayer = player;
youTubeThumbnailView.setVisibility(View.GONE);
youTubePlayerView.setVisibility(View.VISIBLE);
youTubePlayer.loadVideo("o7VVHhK9zf0");
youTubePlayer.seekToMillis(50000);
}
public void onInitializationFailure(Provider arg0, YouTubeInitializationResult arg1) {
youTubePlayerView.setVisibility(View.GONE);
}
});
Run Code Online (Sandbox Code Playgroud) 我是谷歌应用帐户用户.我尝试访问Google Plus Domains API时出现此错误."由于用户已同意不兼容的范围,因此不允许访问Google+域名API".我要求的范围是:" https://www.googleapis.com/auth/plus.circles.read,https://www.googleapis.com/auth/plus.circles.write,https://www .googleapis.com /认证/ plus.media.upload,HTTPS://www.googleapis.com/auth/plus.stream.read,https://www.googleapis.com/auth/plus.stream.write,https ://www.googleapis.com/auth/admin.directory.user,https://www.googleapis.com/auth/admin.directory.user.readonly ".我一直在徒劳地试图解决这个问题.有人可以对此有所了解吗?
在阅读此实施OAuth 2.0身份验证(服务器端)时,我注意到该流程可能适用于创建应用程序的情况,该应用程序允许用户使用其Google凭据登录并随后显示其Google+帖子,Youtube视频等.
我需要的是能够根据谷歌用户的用户名或用户ID获取谷歌数据.我确实有来自Google的client_id,client_secret等 - 而且我愿意按照我的要求发送它们.
第1步似乎没问题.提出类似这样的请求:
https://accounts.google.com/o/oauth2/auth?
client_id=1084945748469-eg34imk572gdhu83gj5p0an9fut6urp5.apps.googleusercontent.com&
redirect_uri=http%3A%2F%2Flocalhost%2Foauth2callback&
scope=https://www.googleapis.com/auth/youtube&
response_type=code&
access_type=offline
Run Code Online (Sandbox Code Playgroud)
在这一步之后可能会有什么好处,只需要获取代码,以便我可以验证我的请求(通过Google_Client() - > authenticate($ _ GET ['code']);或类似的),然后将其交换为auth_token.
我使用Facebook API for PHP获得类似于获取Facebook个人资料/页面公共帖子的内容 - 因此与FB流程的登录不同 - 不需要用户同意也不需要用户同意.
google-api ×10
android ×3
php ×3
json ×2
google-apps ×1
google-oauth ×1
google-plus ×1
gson ×1
java ×1
oauth ×1
oauth-2.0 ×1
ruby ×1
web-services ×1
youtube-api ×1