标签: google-api

在GCM上注册的设备列表

我正在使用 Google Cloud Messaging API.

在服务器端,我想获取在Google Cloud Messaging提供的项目ID上注册的所有设备的列表.因此,我可以获得所有设备列表,以便我可以将所有这些设备存储到数据库中请给我一个关于我们如何做到这一点的建议.谢谢

google-api google-cloud-messaging

1
推荐指数
1
解决办法
2269
查看次数

未捕获的TypeError:无法在Native Messaging App中调用方法'connectNative'

我正在使用本机消息传递应用程序.我创建了以下文件

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

1
推荐指数
1
解决办法
1339
查看次数

Google驱动器api文件已上传但未列出

我是Google Drive API的新手。我正在将文件从服务器上传到Google Drive。

在我的Gmail帐户中

  1. 创建一个服务帐户,下载密钥并上传到服务器
  2. 提供对Drive Api和SDK Api的访问。
  3. 添加了一个与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)

php web-services google-api google-drive-api

1
推荐指数
1
解决办法
2039
查看次数

Google OAuth2(401)凭据无效

所以我有一个我正在研究的应用程序.我在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中抛出

我努力刷新,清除缓存等等,我仍然得到错误.但是,当我关闭浏览器并重新打开它时,一切都重新出现,就像没有发生任何事情一样.

有没有人有这个问题/解决了吗?

建议非常感谢.

最好,

泰勒

php google-api oauth-2.0

1
推荐指数
1
解决办法
3747
查看次数

无法使用GCM发送推送消息

我在我的Android应用程序中实现了GCM.我有1461位用户注册.我正在使用JSON方法向服务器发送消息.当我尝试发送推送消息时,我得到一个错误

"批量邮件数量(1461)超过允许的最大数量(1000)"

是因为GCM对邮件数量有限制吗?或者它是JSON的问题?

android json google-api google-cloud-messaging

1
推荐指数
1
解决办法
1588
查看次数

来自google-api-client的工具google-api无法正常工作

我想创建一个必须访问我的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)

ruby google-api

1
推荐指数
1
解决办法
673
查看次数

Android中的JSON到Java对象不能与GSON一起使用

我试图将一些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)

java android json google-api gson

1
推荐指数
1
解决办法
3268
查看次数

需要Android API seekToMillis()说明

我正在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)

android google-api youtube-api

1
推荐指数
1
解决办法
695
查看次数

1
推荐指数
1
解决办法
1884
查看次数

Google API:使用OAuth验证请求但未经用户同意窗口,然后请求Google数据以获取特定用户名或用户ID

在阅读此实施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流程的登录不同 - 不需要用户同意也不需要用户同意.

php oauth google-api google-oauth google-api-php-client

1
推荐指数
1
解决办法
3713
查看次数