QR 코드 결제를 실행하려면 onClick() 메서드를 입력합니다. 길게 탭하기
사용자에게 앱 정보 화면을 표시하는 타일 이 동작을 재정의하려면 다음 안내를 따르세요.
대신 환경설정 설정을 위한 활동을 실행하고,
다음 활동이 포함된 활동 중 하나에 <intent-filter>하세요.
ACTION_QS_TILE_PREFERENCES
Kotlin
importandroid.service.quicksettings.TileService// Called when the user taps on your tile in an active or inactive state.overridefunonClick(){// Create Intent, replace MainActivity::class.java with QR Code Activityvalintent=Intent(this,MainActivity::class.java)// Create PendingIntentvalpendingIntent=PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_IMMUTABLE)if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE){startActivityAndCollapse(pendingIntent)}else{intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)startActivityAndCollapse(intent)}}
자바
importandroid.service.quicksettings.TileService;// Called when the user taps on your tile in an active or inactive state.@OverridepublicvoidonClick(){// Create Intent, replace MainActivity.class with QR Code ActivityIntentintent=newIntent(MyQSTileService.this,MainActivity.class);// Create PendingIntentPendingIntentpendingIntent=PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_IMMUTABLE);if(VERSION.SDK_INT>=VERSION_CODES.UPSIDE_DOWN_CAKE){startActivityAndCollapse(pendingIntent);}else{intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivityAndCollapse(intent);}}
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Create a QR Code Payment Quick Settings tile\n\nQuick Settings are tiles displayed in the [Quick Settings panel](https://support.google.com/android/answer/9083864).\nUsers can tap these tiles to quickly complete recurring tasks.\nThis document shows you how to create a custom Quick Settings tile for QR Code\npayments.\n\nBefore continuing, be sure you're familiar with general instructions and best\npractices for [creating custom Quick Settings tiles for your app](/develop/ui/views/quicksettings-tiles).\n\nTo [create your tile](/develop/ui/views/quicksettings-tiles#create-tile), follow these steps:\n\n1. [Create your custom icon](/develop/ui/views/quicksettings-tiles#create-custom).\n2. [Create and declare your `TileService`](/develop/ui/views/quicksettings-tiles#create-declare-tileservice).\n\n | **Note:** At this point, your custom tile service will appear in the Quick Settings menu. In order to see your custom tile upon pull down, [edit and\n | rearrange your tiles](https://support.google.com/android/answer/9083864).\n3. To launch the QR Code payment, fill in the `onClick()` method. Long-tapping\n a tile prompts the App Info screen for the user. To override this behavior\n and instead launch an activity for setting preferences, add an\n `\u003cintent-filter\u003e` to one of your activities with\n [`ACTION_QS_TILE_PREFERENCES`](/reference/android/service/quicksettings/TileService.html?utm_campaign=adp_series_quicksettingstiles_092916&utm_source=medium&utm_medium=blog#ACTION_QS_TILE_PREFERENCES).\n\n ### Kotlin\n\n ```kotlin\n import android.service.quicksettings.TileService\n\n // Called when the user taps on your tile in an active or inactive state.\n override fun onClick() {\n // Create Intent, replace MainActivity::class.java with QR Code Activity\n val intent = Intent(this, MainActivity::class.java)\n // Create PendingIntent\n val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)\n if (android.os.Build.VERSION.SDK_INT \u003e= android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {\n startActivityAndCollapse(pendingIntent)\n } else {\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)\n startActivityAndCollapse(intent)\n }\n }\n ```\n\n ### Java\n\n ```java\n import android.service.quicksettings.TileService;\n\n // Called when the user taps on your tile in an active or inactive state.\n @Override\n public void onClick() {\n // Create Intent, replace MainActivity.class with QR Code Activity\n Intent intent = new Intent(MyQSTileService.this, MainActivity.class);\n // Create PendingIntent\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);\n if (VERSION.SDK_INT \u003e= VERSION_CODES.UPSIDE_DOWN_CAKE) {\n startActivityAndCollapse(pendingIntent);\n } else {\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivityAndCollapse(intent);\n }\n }\n ```\n4. To protect users' sensitive payment information, [perform only safe actions\n on securely-locked devices](/develop/ui/views/quicksettings-tiles#perform-only).\n\n ### Kotlin\n\n ```kotlin\n import android.service.quicksettings.TileService\n\n override fun onClick() {\n val intent = Intent(this, MainActivity::class.java)\n val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)\n\n // ...\n\n if (isSecure()) {\n startActivityAndCollapse(pendingIntent)\n } else {\n unlockAndRun {\n startActivityAndCollapse(pendingIntent)\n }\n }\n // ...\n }\n ```\n\n ### Java\n\n ```java\n import android.service.quicksettings.TileService;\n\n @Override\n public void onClick() {\n Intent intent = new Intent(MyQSTileService.this, MainActivity.class);\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);\n ...\n if (isSecure()) {\n startActivityAndCollapse(pendingIntent);\n } else {\n unlockAndRun(new Runnable() {\n @Override\n public void run() {\n startActivityAndCollapse(pendingIntent);\n }\n });\n }\n ...\n }\n ```\n5. When first introducing this feature, [prompt the user to add your\n tile](/develop/ui/views/quicksettings-tiles#prompt-user)."]]