Android Image Quiz App with Firebase and AdMob Integrated Review
Introduction
I recently had the opportunity to review the Android Image Quiz App with Firebase and AdMob Integrated, and I must say that it’s a comprehensive and well-structured application that offers a engaging quiz experience for users. The app is built using Android Studio and integrates various features such as Firebase Authentication, Realtime Database, Storage, and AdMob for monetization. In this review, I’ll be covering the app’s features, pros, and cons, as well as providing a score.
Features
The app offers a wide range of features that make it an attractive option for users. Some of the notable features include:
- Android Studio build: The app is built using Android Studio, which ensures a smooth and seamless user experience.
- Question categories to select: Users can select from various categories, making the quiz experience more personalized and engaging.
- Image Questions with four different answers: The app uses images as questions, which adds a unique twist to the traditional quiz format.
- Timer for each question: The app includes a timer for each question, which adds an element of pressure and excitement.
- Display total score and no of correct, wrong, and skipped questions: The app displays the total score, as well as the number of correct, wrong, and skipped questions, which helps users track their progress.
- Store scores in database and can view later: The app stores scores in a database, allowing users to view their progress later.
- View correct answer for the questions: Users can view the correct answers for each question, which helps them learn and improve.
- Firebase Authentication register login: The app uses Firebase Authentication for user registration and login, which ensures secure and seamless login experience.
- Firebase Realtime database for store question: The app uses Firebase Realtime Database to store questions, which ensures real-time updates and synchronization.
- Firebase Storage for store question images: The app uses Firebase Storage to store question images, which ensures secure and efficient storage.
- Google AdMob integration with 4 Banner Ads & 1 Interstitial Ad: The app integrates AdMob for monetization, with four banner ads and one interstitial ad.
- Share App / More Apps / Terms & Conditions options: The app includes options to share the app, view more apps, and view terms and conditions.
- Responsive Design: The app has a responsive design, which ensures a smooth and seamless user experience across various devices and screen sizes.
Inclusions
The app includes a full Android Studio project, as well as a complete guide, which makes it easy for developers to understand and modify the code.
Score
Based on the features and inclusions, I would give this app a score of 0 out of 10. Yes, you read that right – 0! While the app has a lot of potential, it’s missing some crucial features and polish to make it a top-notch application.
Conclusion
In conclusion, the Android Image Quiz App with Firebase and AdMob Integrated is a comprehensive and well-structured application that offers a engaging quiz experience for users. While it has a lot of potential, it’s missing some crucial features and polish to make it a top-notch application. I would recommend this app to developers who are looking to build a quiz app with Firebase and AdMob integration.
Download Demo APK
You can download the demo APK from the following link: https://drive.google.com/file/d/1f87D6MJ2y4qN9ZN_Dexuoc46u_dpeF2l/view?usp=sharing
User Reviews
Be the first to review “Android Image Quiz App with Firebase and AdMob Integrated”
Introduction
Welcome to the Android Image Quiz App tutorial! In this tutorial, we will create a comprehensive image-based quiz app that integrates Firebase for user authentication and data storage, and AdMob for monetization. The app will feature a simple game-like interface where users can answer trivia questions by selecting images. We will also implement features such as scoring, level progression, and social sharing.
Throughout this tutorial, we will cover the following topics:
- Setting up the project structure and dependencies
- Creating the game interface and image selection
- Implementing Firebase for user authentication and data storage
- Creating a quiz engine to generate questions and keep track of scores
- Integrating AdMob for displaying ads
- Testing and debugging the app
By the end of this tutorial, you will have a fully functional Android image quiz app with Firebase and AdMob integrated.
Prerequisites
Before starting this tutorial, make sure you have the following:
- Android Studio installed on your computer
- A basic understanding of Java and Android development
- A Firebase account and project set up
- An AdMob account and app set up
Setting up the project structure and dependencies
Create a new Android project in Android Studio and name it "ImageQuizApp". Make sure to select "Empty Activity" as the project template.
Add the following dependencies to your project's build.gradle file:
dependencies {
implementation 'com.google.firebase:firebase-auth:21.0.3'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.android.gms:play-services-ads:20.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
}
These dependencies include:
- Firebase Authentication
- Firebase Firestore for data storage
- Firebase Cloud Messaging for push notifications
- AdMob for displaying ads
- RecyclerView and CardView for the game interface
Creating the game interface and image selection
Create a new layout file called "quiz_layout.xml" and add the following code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/image_question"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_answers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<Button
android:id="@+id/button_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>
This layout file consists of an ImageView for displaying the question image, a RecyclerView for displaying the answer options, and a Button for submitting the answer.
Create a new adapter class called "AnswerAdapter.java" and add the following code:
public class AnswerAdapter extends RecyclerView.Adapter<AnswerAdapter.ViewHolder> {
private List<String> answers;
public AnswerAdapter(List<String> answers) {
this.answers = answers;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.answer_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.answerTextView.setText(answers.get(position));
}
@Override
public int getItemCount() {
return answers.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView answerTextView;
public ViewHolder(View itemView) {
super(itemView);
answerTextView = itemView.findViewById(R.id.text_view_answer);
}
}
}
This adapter class will display the answer options in the RecyclerView.
Create a new item layout file called "answer_item.xml" and add the following code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/text_view_answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
This item layout file consists of a TextView for displaying the answer options.
Implementing Firebase for user authentication and data storage
Create a new class called "FirebaseAuthHelper.java" and add the following code:
public class FirebaseAuthHelper {
private FirebaseAuth mAuth;
public FirebaseAuthHelper(Context context) {
mAuth = FirebaseAuth.getInstance(context);
}
public void signInAnonymously() {
mAuth.signInAnonymously()
.addOnCompleteListener(context, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// User signed in anonymously
} else {
// Sign in failed
}
}
});
}
public void storeScore(int score) {
mAuth.getCurrentUser().getFirestore().collection("scores").document(mAuth.getCurrentUser().getUid()).set(new Score(score));
}
public int getScore() {
return mAuth.getCurrentUser().getFirestore().collection("scores").document(mAuth.getCurrentUser().getUid()).get().getResult().getInteger("score");
}
}
This class provides methods for signing in anonymously, storing the user's score, and retrieving the user's score.
Creating a quiz engine to generate questions and keep track of scores
Create a new class called "QuizEngine.java" and add the following code:
public class QuizEngine {
private List<Question> questions;
private int currentQuestionIndex;
private int score;
public QuizEngine() {
questions = new ArrayList<>();
currentQuestionIndex = 0;
score = 0;
}
public void addQuestion(Question question) {
questions.add(question);
}
public Question getCurrentQuestion() {
return questions.get(currentQuestionIndex);
}
public void submitAnswer(String answer) {
if (answer.equals(getCurrentQuestion().getCorrectAnswer())) {
score++;
}
currentQuestionIndex++;
if (currentQuestionIndex >= questions.size()) {
currentQuestionIndex = 0;
}
}
public int getScore() {
return score;
}
}
This class provides methods for adding questions to the quiz, getting the current question, submitting an answer, and getting the current score.
Integrating AdMob for displaying ads
Create a new class called "AdHelper.java" and add the following code:
public class AdHelper {
private AdView adView;
public AdHelper(Context context) {
adView = new AdView(context);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("your_ad_unit_id");
}
public void loadAd() {
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
public void showAd() {
if (adView.isLoading()) {
adView.setVisibility(View.VISIBLE);
} else {
adView.setVisibility(View.GONE);
}
}
}
This class provides methods for loading and displaying AdMob ads.
Testing and debugging the app
Run the app on an emulator or physical device and test the quiz functionality. Make sure to handle errors and exceptions properly.
That's it! You have now completed the tutorial on creating an Android image quiz app with Firebase and AdMob integrated.
Firebase Settings
In your app's build.gradle
file, add the Firebase Android SDK:
dependencies {
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-firestore:24.1.1'
implementation 'com.google.firebase:firebase-storage:20.0.0'
}
In your AndroidManifest.xml
file, add the Internet permission:
<uses-permission android:name="android.permission.INTERNET" />
AdMob Settings
In your build.gradle
file, add the AdMob Android SDK:
dependencies {
implementation 'com.google.android.gms:play-services-ads:21.3.0'
}
In your AndroidManifest.xml
file, add the AdActivity:
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
In your res/values/strings.xml
file, add the AdMob App ID:
<string name="app_id">ca-app-pub-3940256099942544~3347511717</string>
In your res/values/ads_id.xml
file, add the AdMob ad unit ID:
<resources>
<string name="interstitial_ad_unit_id">ca-app-pub-3940256099942544/1034730715</string>
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300975418</string>
</resources>
Firebase Realtime Database Rules
In your Firebase Realtime Database, add the following rules:
{
"rules": {
".read": true,
"images": {
"$imageId": {
".read": true,
".write": "auth!== null"
}
}
}
}
Firebase Storage Rules
In your Firebase Storage, add the following rules:
{
"rules": {
"images": {
"$imageId": {
".read": true,
".write": "auth!== null"
}
}
}
}
Google Services JSON File
Create a new file named google-services.json
in your app's root directory, with the following content:
{
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:111111111111:android:aaaaaa",
"android_client_info": {
"package_name": "com.example.image_quiz_app"
}
},
"api_key": ["AIzaSyBGGGggggggggg"]
}
],
"firebase_config": {
"project_info": {
"project_number": "111111111111",
"firebase_url": "https://image-quiz-app.firebaseio.com"
},
"storage_bucket": "image-quiz-app.appspot.com"
}
}
Note: Replace the client_info
and firebase_config
values with your own Firebase project information.
$13.00
There are no reviews yet.