gpt4 book ai didi

Android - 是否可以通过 Google Developer API 升级为 Beta 版?

转载 作者:行者123 更新时间:2023-11-30 02:06:36 24 4
gpt4 key购买 nike

目前,如果我想将我的 Android 应用从 Alpha 升级到 Beta,我会在 Google Developer Console 中进行。我正在尝试使用 Google API 的 C# 客户端自动执行此过程。是否可以?如果是这样,我很乐意看到代码示例。谢谢!

最佳答案

我会根据我在这里得到的答案自己回答:https://github.com/googlesamples/android-play-publisher-api/issues/20#issuecomment-107923343

这样的东西对我有用:

        var service = new AndroidPublisherService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});

// Insert new edit
var edit = new AppEdit()
{
ExpiryTimeSeconds = ToEpochTime(DateTime.UtcNow.AddMinutes(30)).ToString()
};
edit = service.Edits.Insert(edit, packageName).Execute();

// Fetching the Alpha track and clearing the version code from it
var tracks = service.Edits.Tracks.List(packageName, edit.Id).Execute().Tracks;
var alphaTrack = tracks.Single(track => track.TrackValue.Equals(EditsResource.TestersResource.GetRequest.TrackEnum.Alpha.ToString(), StringComparison.InvariantCultureIgnoreCase));
var versionCode = alphaTrack.VersionCodes.Single();
alphaTrack.VersionCodes.Clear();
service.Edits.Tracks.Patch(alphaTrack, packageName, edit.Id, EditsResource.TracksResource.PatchRequest.TrackEnum.Alpha).Execute();

// Updating a Beta track with the same version code as in the Alpha track
var betaTrack = new Track {TrackValue = "beta", VersionCodes = new [] { versionCode }};
service.Edits.Tracks.Update(betaTrack, packageName, edit.Id, EditsResource.TracksResource.UpdateRequest.TrackEnum.Beta).Execute();

// Commit the edit
service.Edits.Commit(packageName, edit.Id).Execute();

关于Android - 是否可以通过 Google Developer API 升级为 Beta 版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30590994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com