새 빌드를 구글 플레이 스토어에 업로드 시, 기존 앱을 이미 설치한 사용자에게 새 빌드로 갱신하도록 알려줄 필요가 있다. 인앱 업데이트 모듈을 적용하면, 손쉽게 새 빌드를 앱 내에서 설치할 수 있다. 우선 순위에 따라 앱 업데이트 팝업의 종류를 다르게 나타낼 수 있다.
- 즉시 업데이트(Immediate update), 전체 화면 팝업
- 유연한 업데이트(Flexible update), 하단 팝업
- 업데이트 알림 없음, 팝업 없음
인앱 업데이트 모듈 적용은 유니티에서 손쉽게 할 수 있다. (링크)
인앱 업데이트 지원(Unity) | Android Developers
이 페이지는 Cloud Translation API를 통해 번역되었습니다. 인앱 업데이트 지원(Unity) 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 이 가이드에서는 Unity를 사용
developer.android.com
그런데 우선 순위를 적용하는 방법은 까다롭다. 내부 테스트(또는 프로덕션)에 앱을 업로드 할 때, 최종 배포를 완료하기 전(앱 업로드 후, 릴리즈 노트 쓰고 임시 저장까지만 한다. 마지막 완료 버튼을 누르지 않는다)에 구글 클라우드의 API를 호출해서 해당 우선 순위 값을 설정해야 한다(update-priority.js 참고)
구글 클라우드에서 Google Play Developer API를 호출하기 위한 환경 설정
- 구글 클라우드 콘솔에 접속해서 로그인
- 로그인 계정은 Play Console과 연결된 오너(owner) 계정이어야 한다.
- 새 프로젝트 생성
- Google Play Developer API 검색 후 활성화
- OAuth 동의 화면 설정
- 서비스 계정 설정
- 서비스 계정 키(Json) 생성
- 구글 플레이 콘솔과 연결
- 구글 플레이 콘솔의 사용자 및 권한 메뉴에서 GCP에서 생성한 서비스 계정을 신규 사용자로 추가
Google Play Developer API 호출하기
- Node.js 설치
- node update-priority.js (스크립트 실행)
- 서비스 Json key 파일 경로 설정 (한 번만)
- 앱 패키지 이름 설정 (한 번만)
- inAppUpdatePriority, versionCode, version, track 설정 (현재 업데이트 할 앱 정보에 맞게)
update-priority.js
const { google } = require("googleapis");
const path = require("path");
// Path to your service account JSON key file
const SERVICE_ACCOUNT_FILE = path.join(__dirname, "xxx.json"); // Replace with your json key path
// Authenticate with Google Play API
async function authenticate() {
const auth = new google.auth.GoogleAuth({
keyFile: SERVICE_ACCOUNT_FILE,
scopes: ["https://www.googleapis.com/auth/androidpublisher"],
});
return await auth.getClient();
}
// Function to update in-app update priority
async function updateInAppUpdatePriority(packageName, versionCode, releaseName, track) {
const authClient = await authenticate();
const androidPublisher = google.androidpublisher({ version: "v3", auth: authClient });
// Start an edit session
const edit = await androidPublisher.edits.insert({ packageName });
const editId = edit.data.id;
console.log("Edit ID:", editId);
// Update release priority
const updateResponse = await androidPublisher.edits.tracks.update({
packageName,
editId,
track,
requestBody: {
releases: [
{
name: releaseName,
status: "completed",
versionCodes: [String(versionCode)],
inAppUpdatePriority: 5, // Set priority (1-5, higher is more urgent)
},
],
},
});
console.log("Updated Release:", updateResponse.data);
// Commit the edit
const commitResponse = await androidPublisher.edits.commit({
packageName,
editId,
});
console.log("Edit committed successfully:", commitResponse.data);
}
// Call the function with your app details
const packageName = "com.company.example"; // Replace with your package name
const versionCode = 100; // Replace with your actual version code
const version = "0.1.0";
const releaseName = `${versionCode} (${version})`;
const track = "internal"; // Can be 'internal', 'alpha', 'beta', or 'production'
updateInAppUpdatePriority(packageName, versionCode, releaseName, track).catch(console.error);
'미스터리 던전 (Mystery Dungeon)' 카테고리의 다른 글
[유니티] 구글 리더보드 추가 시 GPGS와 Firebase 충돌 이슈 해결 방법 (0) | 2025.06.24 |
---|---|
iOS 앱 유럽 판매 불가 이슈 (0) | 2025.05.21 |
Firebase Analytics Parameter (not set) 이슈 (0) | 2025.04.14 |
무겁지 않게 가볍게 (0) | 2025.04.03 |
게임 앱 출시 후 가장 먼저 해결 해야 할 것 (0) | 2025.03.28 |