当前位置: 首页>>代码示例>>Java>>正文


Java AndroidPublisherScopes类代码示例

本文整理汇总了Java中com.google.api.services.androidpublisher.AndroidPublisherScopes的典型用法代码示例。如果您正苦于以下问题:Java AndroidPublisherScopes类的具体用法?Java AndroidPublisherScopes怎么用?Java AndroidPublisherScopes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AndroidPublisherScopes类属于com.google.api.services.androidpublisher包,在下文中一共展示了AndroidPublisherScopes类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authorizeWithServiceAccount

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
private static Credential authorizeWithServiceAccount(String serviceAccountEmail)
        throws GeneralSecurityException, IOException {
    log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));

    // Build service account credential.
    log.info("Loading service account key ...");
    final InputStream is = AndroidPublisherHelper.class.getResourceAsStream(SRC_RESOURCES_KEY_P12);
    File keyFile = getTempFile(is, "key");
    log.info("keyFile.exists() = " + keyFile.exists());
    log.info("keyFile.length() = " + keyFile.length());
    GoogleCredential credential = new GoogleCredential.Builder()
            .setTransport(HTTP_TRANSPORT)
            .setJsonFactory(JSON_FACTORY)
            .setServiceAccountId(serviceAccountEmail)
            .setServiceAccountScopes(
                    Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
            .setServiceAccountPrivateKeyFromP12File(keyFile)
            .build();
    return credential;
}
 
开发者ID:wisobi,项目名称:leanbean,代码行数:21,代码来源:AndroidPublisherHelper.java

示例2: authorizeWithInstalledApplication

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
/**
 * Authorizes the installed application to access user's protected data.
 *
 * @throws IOException
 * @throws GeneralSecurityException
 */
private static Credential authorizeWithInstalledApplication() throws IOException {
    log.info("Authorizing using installed application");

    // load client secrets
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
            JSON_FACTORY,
            new InputStreamReader(
                    AndroidPublisherHelper.class
                            .getResourceAsStream(RESOURCES_CLIENT_SECRETS_JSON)));
    // Ensure file has been filled out.
    checkClientSecretsFile(clientSecrets);

    dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);

    // set up authorization code flow
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow
            .Builder(HTTP_TRANSPORT,
            JSON_FACTORY, clientSecrets,
            Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
            .setDataStoreFactory(dataStoreFactory).build();
    // authorize
    return new AuthorizationCodeInstalledApp(
            flow, new LocalServerReceiver()).authorize(INST_APP_USER_ID);
}
 
开发者ID:wisobi,项目名称:leanbean,代码行数:31,代码来源:AndroidPublisherHelper.java

示例3: authorizeWithServiceAccount

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
private static Credential authorizeWithServiceAccount(String serviceAccountEmail,
												  File serviceAccountKeyFile)
          throws GeneralSecurityException, IOException {
      log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));

      // Build service account credential.
log.info("Using service key file: "+serviceAccountKeyFile.getAbsolutePath());
      GoogleCredential credential = new GoogleCredential.Builder()
              .setTransport(HTTP_TRANSPORT)
              .setJsonFactory(JSON_FACTORY)
              .setServiceAccountId(serviceAccountEmail)
              .setServiceAccountScopes(
                      Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
              .setServiceAccountPrivateKeyFromP12File(serviceAccountKeyFile)
              .build();
      return credential;
  }
 
开发者ID:bluesliverx,项目名称:gradle-android-publisher,代码行数:18,代码来源:AndroidPublisherHelper.java

示例4: authorizeWithInstalledApplication

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
/**
 * Authorizes the installed application to access user's protected data.
 *
 * @throws IOException
 * @throws GeneralSecurityException
 */
private static Credential authorizeWithInstalledApplication() throws IOException {
    log.info("Authorizing using installed application");

    // load client secrets
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
            JSON_FACTORY,
            new InputStreamReader(
                    AndroidPublisherHelper.class
                            .getResourceAsStream(RESOURCES_CLIENT_SECRETS_JSON)));
    // Ensure file has been filled out.
    checkClientSecretsFile(clientSecrets);

    dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);

    // set up authorization code flow
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow
            .Builder(HTTP_TRANSPORT,
                    JSON_FACTORY, clientSecrets,
                    Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
                    .setDataStoreFactory(dataStoreFactory).build();
    // authorize
    return new AuthorizationCodeInstalledApp(
            flow, new LocalServerReceiver()).authorize(INST_APP_USER_ID);
}
 
开发者ID:rocel,项目名称:playstorepublisher,代码行数:31,代码来源:AndroidPublisherHelper.java

示例5: authorizeWithServiceAccount

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
/**
 * Global instance of the {@link com.google.api.client.util.store.DataStoreFactory}. The best practice is to
 * make it a single globally shared instance across your application.
 */

private static Credential authorizeWithServiceAccount(String serviceAccountEmail, File pk12File)
        throws GeneralSecurityException, IOException {
    log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));

    // Build service account credential.
    GoogleCredential credential = new GoogleCredential.Builder()
            .setTransport(HTTP_TRANSPORT)
            .setJsonFactory(JSON_FACTORY)
            .setServiceAccountId(serviceAccountEmail)
            .setServiceAccountScopes(
                    Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
            .setServiceAccountPrivateKeyFromP12File(pk12File)
            .build();
    return credential;
}
 
开发者ID:chrissd23,项目名称:play-publisher-bootstrapper,代码行数:21,代码来源:AndroidPublisherHelper.java

示例6: init

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
public static AndroidPublisher init(Context context, String fileName) throws IOException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(context.getPackageName()), "applicationId cannot be null or empty!");
    newTrustedTransport();
    GoogleCredential credential = GoogleCredential.fromStream(context.getAssets().open(fileName), HTTP_TRANSPORT, JSON_FACTORY);
    credential = credential.createScoped(Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER));

    return new AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
            .setApplicationName(context.getPackageName())
            .build();
}
 
开发者ID:sugoi-wada,项目名称:appversionchecker,代码行数:11,代码来源:AndroidPublisherHelper.java

示例7: authorizeWithServiceAccount

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
private static Credential authorizeWithServiceAccount(String serviceAccountEmail)
        throws GeneralSecurityException, IOException {
    log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));

    // Build service account credential.
    GoogleCredential credential = new GoogleCredential.Builder()
            .setTransport(HTTP_TRANSPORT)
            .setJsonFactory(JSON_FACTORY)
            .setServiceAccountId(serviceAccountEmail)
            .setServiceAccountScopes(
                    Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
            .setServiceAccountPrivateKeyFromP12File(new File(PropertiesComponent.getInstance().getValue(GoogleConfigurationView.KEY_PATH_TO_P12)))
            .build();
    return credential;
}
 
开发者ID:droidchef,项目名称:pubplug,代码行数:16,代码来源:AndroidPublisherHelper.java

示例8: authorizeWithServiceAccount

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
private static Credential authorizeWithServiceAccount(String serviceAccountEmail)
        throws GeneralSecurityException, IOException {
    log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));

    // Build service account credential.
    GoogleCredential credential = new GoogleCredential.Builder()
            .setTransport(HTTP_TRANSPORT)
            .setJsonFactory(JSON_FACTORY)
            .setServiceAccountId(serviceAccountEmail)
            .setServiceAccountScopes(
                    Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
            .setServiceAccountPrivateKeyFromP12File(new File(SRC_RESOURCES_KEY_P12))
            .build();
    return credential;
}
 
开发者ID:rocel,项目名称:playstorepublisher,代码行数:16,代码来源:AndroidPublisherHelper.java

示例9: getScopes

import com.google.api.services.androidpublisher.AndroidPublisherScopes; //导入依赖的package包/类
@Override
public Collection<String> getScopes() {
	return Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER);
}
 
开发者ID:DavidHamm,项目名称:google-play-publisher,代码行数:5,代码来源:AndroidPublisherScopeRequirement.java


注:本文中的com.google.api.services.androidpublisher.AndroidPublisherScopes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。