本文整理汇总了Java中com.google.api.services.androidpublisher.AndroidPublisher类的典型用法代码示例。如果您正苦于以下问题:Java AndroidPublisher类的具体用法?Java AndroidPublisher怎么用?Java AndroidPublisher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidPublisher类属于com.google.api.services.androidpublisher包,在下文中一共展示了AndroidPublisher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
/**
* Performs all necessary setup steps for running requests against the API.
*
* @param applicationName the name of the application: com.example.app
* @param serviceAccountEmail the Service Account Email (empty if using
* installed application)
* @return the {@Link AndroidPublisher} service
* @throws GeneralSecurityException
* @throws IOException
*/
public static AndroidPublisher init(String applicationName,
@Nullable String serviceAccountEmail) throws IOException, GeneralSecurityException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
"applicationName cannot be null or empty!");
// Authorization.
newTrustedTransport();
Credential credential;
if (serviceAccountEmail == null || serviceAccountEmail.isEmpty()) {
//TODO : ask for the service account and key.p12 file with a dialog ;)
credential = authorizeWithServiceAccount(serviceAccountEmail);
} else {
credential = authorizeWithServiceAccount(serviceAccountEmail);
}
// Set up and return API client.
return new AndroidPublisher.Builder(
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
.build();
}
开发者ID:droidchef,项目名称:pubplug,代码行数:31,代码来源:AndroidPublisherHelper.java
示例2: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
/**
* Performs all necessary setup steps for running requests against the API.
*
* @param applicationName the name of the application: com.example.app
* @param serviceAccountEmail the Service Account Email (empty if using
* installed application)
* @return the {@Link AndroidPublisher} service
* @throws GeneralSecurityException
* @throws IOException
*/
protected static AndroidPublisher init(String applicationName,
@Nullable String serviceAccountEmail) throws IOException, GeneralSecurityException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
"applicationName cannot be null or empty!");
// Authorization.
newTrustedTransport();
Credential credential;
if (serviceAccountEmail == null || serviceAccountEmail.isEmpty()) {
credential = authorizeWithInstalledApplication();
} else {
credential = authorizeWithServiceAccount(serviceAccountEmail);
}
// Set up and return API client.
return new AndroidPublisher.Builder(
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
.build();
}
开发者ID:wisobi,项目名称:leanbean,代码行数:30,代码来源:AndroidPublisherHelper.java
示例3: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
/**
* Performs all necessary setup steps for running requests against the API.
*
* @param applicationName the name of the application: com.example.app
* @param serviceAccountEmail the Service Account Email (empty if using
* installed application)
* @return the {@Link AndroidPublisher} service
* @throws GeneralSecurityException
* @throws IOException
*/
protected static AndroidPublisher init(String applicationName,
String serviceAccountEmail, File serviceAccountKeyFile)
throws IOException, GeneralSecurityException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
"Application name cannot be null or empty!");
// Authorization.
newTrustedTransport();
Credential credential = authorizeWithServiceAccount(serviceAccountEmail, serviceAccountKeyFile);
// Set up and return API client.
return new AndroidPublisher.Builder(
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
.build();
}
开发者ID:bluesliverx,项目名称:gradle-android-publisher,代码行数:26,代码来源:AndroidPublisherHelper.java
示例4: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
/**
* Performs all necessary setup steps for running requests against the API.
*
* @param applicationName the name of the application: com.example.app
* @param serviceAccountEmail the Service Account Email (empty if using
* installed application)
* @return the {@Link AndroidPublisher} service
* @throws GeneralSecurityException
* @throws IOException
*/
protected static AndroidPublisher init(String applicationName,
@Nullable String serviceAccountEmail) throws IOException, GeneralSecurityException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
"applicationName cannot be null or empty!");
// Authorization.
newTrustedTransport();
Credential credential;
if (serviceAccountEmail == null || serviceAccountEmail.isEmpty()) {
credential = authorizeWithInstalledApplication();
} else {
credential = authorizeWithServiceAccount(serviceAccountEmail);
}
// Set up and return API client.
return new AndroidPublisher.Builder(
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
.build();
}
开发者ID:rocel,项目名称:playstorepublisher,代码行数:30,代码来源:AndroidPublisherHelper.java
示例5: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的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
示例6: createAndroidPublisherEdits
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
private void createAndroidPublisherEdits() throws NextAvailableVersionCodeFetcherException {
try {
final Credential credential = credentials.getGoogleCredential(new AndroidPublisherScopeRequirement());
edits = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential)
.setApplicationName(APPLICATION_NAME)
.build()
.edits();
} catch (GeneralSecurityException e) {
throw new NextAvailableVersionCodeFetcherException("Failed to create Android Publisher Edits", e);
}
}
开发者ID:DavidHamm,项目名称:google-play-publisher,代码行数:12,代码来源:NextAvailableVersionCodeFetcherHelper.java
示例7: createAndroidPublisherEdits
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
private void createAndroidPublisherEdits() throws PublishApkException {
try {
final Credential credential = credentials.getGoogleCredential(new AndroidPublisherScopeRequirement());
edits = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential)
.setApplicationName(APPLICATION_NAME)
.build()
.edits();
} catch (GeneralSecurityException e) {
throw new PublishApkException("Failed to create Android Publisher Edits", e);
}
}
开发者ID:DavidHamm,项目名称:google-play-publisher,代码行数:12,代码来源:PublishHelper.java
示例8: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
/**
* Performs all necessary setup steps for running requests against the API.
*
* @param applicationName the name of the application: com.example.app
* @param serviceAccountEmail the Service Account Email (empty if using
* installed application)
* @return the {@Link AndroidPublisher} service
* @throws java.security.GeneralSecurityException
* @throws java.io.IOException
*/
protected static AndroidPublisher init(String serviceAccountEmail, File pk12File)
throws IOException, GeneralSecurityException {
// Authorization.
newTrustedTransport();
Credential credential = authorizeWithServiceAccount(serviceAccountEmail, pk12File);
// Set up and return API client.
return new AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
.setApplicationName(APPLICATION_NAME)
.build();
}
开发者ID:chrissd23,项目名称:play-publisher-bootstrapper,代码行数:23,代码来源:AndroidPublisherHelper.java
示例9: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
final AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create a new edit to make changes.
Insert editRequest = edits
.insert(ApplicationConfig.PACKAGE_NAME,
null /** no content */);
AppEdit appEdit = editRequest.execute();
// Get a list of apks.
ApksListResponse apksResponse = edits
.apks()
.list(ApplicationConfig.PACKAGE_NAME,
appEdit.getId()).execute();
// Print the apk info.
for (Apk apk : apksResponse.getApks()) {
System.out.println(
String.format("Version: %d - Binary sha1: %s", apk.getVersionCode(),
apk.getBinary().getSha1()));
}
} catch (IOException | GeneralSecurityException ex) {
log.error("Exception was thrown while updating listing", ex);
}
}
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:33,代码来源:ListApks.java
示例10: init
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public void init(Context context, String packageName, String jsonAssetsFileName) throws IOException {
this.packageName = packageName;
AndroidPublisher publisher = AndroidPublisherHelper.init(context, jsonAssetsFileName);
edits = publisher.edits();
id = edits.insert(packageName, null).execute().getId();
}
开发者ID:sugoi-wada,项目名称:appversionchecker,代码行数:7,代码来源:StoreApi.java
示例11: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create a new edit to make changes to your listing.
Insert editRequest = edits
.insert(ApplicationConfig.PACKAGE_NAME,
null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Upload new apk to developer console
final InputStream is = BasicUploadApk.class.getResourceAsStream((ApplicationConfig.APK_FILE_PATH));
File apkTmpFile = AndroidPublisherHelper.getTempFile(is, "apk");
URL resource = BasicUploadApk.class.getResource(ApplicationConfig.APK_FILE_PATH);
//final String apkPath = BasicUploadApk.class
// .getResource(ApplicationConfig.APK_FILE_PATH)
// .toURI().getPath();
final AbstractInputStreamContent apkFile =
new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, apkTmpFile);
Upload uploadRequest = edits
.apks()
.upload(ApplicationConfig.PACKAGE_NAME,
editId,
apkFile);
Apk apk = uploadRequest.execute();
log.info(String.format("Version code %d has been uploaded",
apk.getVersionCode()));
// Assign apk to alpha track.
List<Integer> apkVersionCodes = new ArrayList<>();
apkVersionCodes.add(apk.getVersionCode());
Update updateTrackRequest = edits
.tracks()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
TRACK_ALPHA,
new Track().setVersionCodes(apkVersionCodes));
Track updatedTrack = updateTrackRequest.execute();
log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | GeneralSecurityException ex) {
log.error("Excpetion was thrown while uploading apk to alpha track", ex);
}
}
开发者ID:wisobi,项目名称:leanbean,代码行数:58,代码来源:BasicUploadApk.java
示例12: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME), "ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create a new edit to make changes to your listing.
Insert editRequest = edits.insert(ApplicationConfig.PACKAGE_NAME, null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Upload new apk to developer console
final String apkPath = BasicUploadApk.class
.getResource(ApplicationConfig.APK_FILE_PATH)
.toURI().getPath();
final AbstractInputStreamContent apkFile = new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
Upload uploadRequest = edits
.apks()
.upload(ApplicationConfig.PACKAGE_NAME,
editId,
apkFile);
Apk apk = uploadRequest.execute();
log.info(String.format("Version code %d has been uploaded",
apk.getVersionCode()));
// Assign apk to alpha track.
List<Integer> apkVersionCodes = new ArrayList<Integer>();
apkVersionCodes.add(apk.getVersionCode());
Update updateTrackRequest = edits
.tracks()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
TRACK_ALPHA,
new Track().setVersionCodes(apkVersionCodes));
Track updatedTrack = updateTrackRequest.execute();
log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | URISyntaxException | GeneralSecurityException ex) {
log.error("Excpetion was thrown while uploading apk to alpha track", ex);
}
}
开发者ID:rocel,项目名称:playstorepublisher,代码行数:52,代码来源:BasicUploadApk.java
示例13: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create an edit to update listing for application.
Insert editRequest = edits
.insert(ApplicationConfig.PACKAGE_NAME,
null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Update listing for US version of the application.
final Listing newUsListing = new Listing();
newUsListing.setTitle(US_LISTING_TITLE)
.setFullDescription(US_LISTING_FULL_DESCRIPTION)
.setShortDescription(US_LISTING_SHORT_DESCRITPION)
.setVideo(LISTINGS_PROMO_VIDEO);
Update updateUSListingsRequest = edits
.listings()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
Locale.US.toString(),
newUsListing);
Listing updatedUsListing = updateUSListingsRequest.execute();
log.info(String.format("Created new US app listing with title: %s",
updatedUsListing.getTitle()));
// Create and update listing for UK version of the application.
final Listing newUkListing = new Listing();
newUkListing.setTitle(UK_LISTING_TITLE)
.setFullDescription(UK_LISTING_FULL_DESCRIPTION)
.setShortDescription(UK_LISTING_SHORT_DESCRITPION)
.setVideo(LISTINGS_PROMO_VIDEO);
Update updateUkListingsRequest = edits
.listings()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
Locale.UK.toString(),
newUkListing);
Listing updatedUkListing = updateUkListingsRequest.execute();
log.info(String.format("Created new UK app listing with title: %s",
updatedUkListing.getTitle()));
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | GeneralSecurityException ex) {
log.error("Exception was thrown while updating listing", ex);
}
}
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:62,代码来源:UpdateListing.java
示例14: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create a new edit to make changes to your listing.
Insert editRequest = edits
.insert(ApplicationConfig.PACKAGE_NAME,
null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Upload new apk to developer console
final String apkPath = BasicUploadApk.class
.getResource(ApplicationConfig.APK_FILE_PATH)
.toURI().getPath();
final AbstractInputStreamContent apkFile =
new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
Upload uploadRequest = edits
.apks()
.upload(ApplicationConfig.PACKAGE_NAME,
editId,
apkFile);
Apk apk = uploadRequest.execute();
log.info(String.format("Version code %d has been uploaded",
apk.getVersionCode()));
// Assign apk to alpha track.
List<Integer> apkVersionCodes = new ArrayList<>();
apkVersionCodes.add(apk.getVersionCode());
Update updateTrackRequest = edits
.tracks()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
TRACK_ALPHA,
new Track().setVersionCodes(apkVersionCodes));
Track updatedTrack = updateTrackRequest.execute();
log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | URISyntaxException | GeneralSecurityException ex) {
log.error("Excpetion was thrown while uploading apk to alpha track", ex);
}
}
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:55,代码来源:BasicUploadApk.java
示例15: main
import com.google.api.services.androidpublisher.AndroidPublisher; //导入依赖的package包/类
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create a new edit to make changes.
Insert editRequest = edits
.insert(ApplicationConfig.PACKAGE_NAME,
null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Upload new apk to developer console
final String apkPath = UploadApkWithListing.class
.getResource(ApplicationConfig.APK_FILE_PATH)
.toURI().getPath();
final AbstractInputStreamContent apkFile =
new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
Upload uploadRequest = edits
.apks()
.upload(ApplicationConfig.PACKAGE_NAME,
editId,
apkFile);
Apk apk = uploadRequest.execute();
log.info(String.format("Version code %d has been uploaded",
apk.getVersionCode()));
// Assign apk to beta track.
List<Integer> apkVersionCodes = new ArrayList<>();
apkVersionCodes.add(apk.getVersionCode());
Update updateTrackRequest = edits
.tracks()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
TRACK_BETA,
new Track().setVersionCodes(apkVersionCodes));
Track updatedTrack = updateTrackRequest.execute();
log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));
// Update recent changes field in apk listing.
final ApkListing newApkListing = new ApkListing();
newApkListing.setRecentChanges(APK_LISTING_RECENT_CHANGES_TEXT);
Apklistings.Update
updateRecentChangesRequest = edits
.apklistings()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
apk.getVersionCode(),
Locale.US.toString(),
newApkListing);
updateRecentChangesRequest.execute();
log.info("Recent changes has been updated.");
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | URISyntaxException | GeneralSecurityException ex) {
log.error(
"Exception was thrown while uploading apk and updating recent changes",
ex);
}
}
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:72,代码来源:UploadApkWithListing.java
注:本文中的com.google.api.services.androidpublisher.AndroidPublisher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论