Skip to content

Commit ae07804

Browse files
authored
Update test app. (#3655)
1 parent c32c180 commit ae07804

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

appcheck/firebase-appcheck/test-app/src/main/java/com/googletest/firebase/appcheck/MainActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.google.firebase.appcheck.FirebaseAppCheck;
3131
import com.google.firebase.appcheck.FirebaseAppCheck.AppCheckListener;
3232
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
33+
import com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory;
3334
import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory;
3435
import com.google.firebase.storage.FirebaseStorage;
3536
import com.google.firebase.storage.ListResult;
@@ -42,6 +43,7 @@ public class MainActivity extends AppCompatActivity {
4243
private FirebaseAppCheck firebaseAppCheck;
4344
private FirebaseStorage firebaseStorage;
4445
private AppCheckListener appCheckListener;
46+
private Button installPlayIntegrityButton;
4547
private Button installSafetyNetButton;
4648
private Button installDebugButton;
4749
private Button getAppCheckTokenButton;
@@ -80,6 +82,7 @@ public void onAppCheckTokenChanged(@NonNull AppCheckToken token) {
8082
}
8183

8284
private void initViews() {
85+
installPlayIntegrityButton = findViewById(R.id.install_play_integrity_app_check_button);
8386
installSafetyNetButton = findViewById(R.id.install_safety_net_app_check_button);
8487
installDebugButton = findViewById(R.id.install_debug_app_check_button);
8588
getAppCheckTokenButton = findViewById(R.id.exchange_app_check_button);
@@ -89,6 +92,17 @@ private void initViews() {
8992
}
9093

9194
private void setOnClickListeners() {
95+
installPlayIntegrityButton.setOnClickListener(
96+
new OnClickListener() {
97+
@Override
98+
public void onClick(View v) {
99+
firebaseAppCheck.installAppCheckProviderFactory(
100+
PlayIntegrityAppCheckProviderFactory.getInstance());
101+
Log.d(TAG, "Installed PlayIntegrityAppCheckProvider");
102+
showToast("Installed PlayIntegrityAppCheckProvider.");
103+
}
104+
});
105+
92106
installSafetyNetButton.setOnClickListener(
93107
new OnClickListener() {
94108
@Override

appcheck/firebase-appcheck/test-app/src/main/res/layout/activity_main.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
android:gravity="center"
77
android:orientation="vertical">
88

9+
<Button
10+
android:id="@+id/install_play_integrity_app_check_button"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:text="@string/install_play_integrity_app_check_button_text"/>
914
<Button
1015
android:id="@+id/install_safety_net_app_check_button"
1116
android:layout_width="wrap_content"

appcheck/firebase-appcheck/test-app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<resources>
22
<string name="app_name">App Check Test Application</string>
3+
<string name="install_play_integrity_app_check_button_text">Install PlayIntegrityAppCheckProvider</string>
34
<string name="install_safety_net_app_check_button_text">Install SafetyNetAppCheckProvider</string>
45
<string name="install_debug_app_check_button_text">Install DebugAppCheckProvider</string>
56
<string name="exchange_app_check_button_text">Exchange attestation for App Check token</string>

appcheck/firebase-appcheck/test-app/test-app.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ dependencies {
4545
implementation project(":appcheck:firebase-appcheck")
4646
implementation project(":appcheck:firebase-appcheck-debug")
4747
implementation project(":appcheck:firebase-appcheck-interop")
48+
implementation project(":appcheck:firebase-appcheck-playintegrity")
4849
implementation project(":appcheck:firebase-appcheck-safetynet")
4950
implementation project(":firebase-storage")
5051
}

0 commit comments

Comments
 (0)