Skip to content

Update test app. #3655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.firebase.appcheck.FirebaseAppCheck;
import com.google.firebase.appcheck.FirebaseAppCheck.AppCheckListener;
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
import com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory;
import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.ListResult;
Expand All @@ -42,6 +43,7 @@ public class MainActivity extends AppCompatActivity {
private FirebaseAppCheck firebaseAppCheck;
private FirebaseStorage firebaseStorage;
private AppCheckListener appCheckListener;
private Button installPlayIntegrityButton;
private Button installSafetyNetButton;
private Button installDebugButton;
private Button getAppCheckTokenButton;
Expand Down Expand Up @@ -80,6 +82,7 @@ public void onAppCheckTokenChanged(@NonNull AppCheckToken token) {
}

private void initViews() {
installPlayIntegrityButton = findViewById(R.id.install_play_integrity_app_check_button);
installSafetyNetButton = findViewById(R.id.install_safety_net_app_check_button);
installDebugButton = findViewById(R.id.install_debug_app_check_button);
getAppCheckTokenButton = findViewById(R.id.exchange_app_check_button);
Expand All @@ -89,6 +92,17 @@ private void initViews() {
}

private void setOnClickListeners() {
installPlayIntegrityButton.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
firebaseAppCheck.installAppCheckProviderFactory(
PlayIntegrityAppCheckProviderFactory.getInstance());
Log.d(TAG, "Installed PlayIntegrityAppCheckProvider");
showToast("Installed PlayIntegrityAppCheckProvider.");
}
});

installSafetyNetButton.setOnClickListener(
new OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
android:gravity="center"
android:orientation="vertical">

<Button
android:id="@+id/install_play_integrity_app_check_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/install_play_integrity_app_check_button_text"/>
<Button
android:id="@+id/install_safety_net_app_check_button"
android:layout_width="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources>
<string name="app_name">App Check Test Application</string>
<string name="install_play_integrity_app_check_button_text">Install PlayIntegrityAppCheckProvider</string>
<string name="install_safety_net_app_check_button_text">Install SafetyNetAppCheckProvider</string>
<string name="install_debug_app_check_button_text">Install DebugAppCheckProvider</string>
<string name="exchange_app_check_button_text">Exchange attestation for App Check token</string>
Expand Down
1 change: 1 addition & 0 deletions appcheck/firebase-appcheck/test-app/test-app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
implementation project(":appcheck:firebase-appcheck")
implementation project(":appcheck:firebase-appcheck-debug")
implementation project(":appcheck:firebase-appcheck-interop")
implementation project(":appcheck:firebase-appcheck-playintegrity")
implementation project(":appcheck:firebase-appcheck-safetynet")
implementation project(":firebase-storage")
}
Expand Down