Introduction
As an Android app developer, I was excited to come across The Quizzle app, a fully native android application with a sleek and modern material design. I downloaded the demo APK and played around with it to see what it has to offer. In this review, I’ll dive deep into the features and pros of this app, along with its admin panel, Admob, and OneSignal integration.
Pros
The Quizzle app has a lot of pros to offer. The Material Design is top-notch, providing a seamless and responsive user experience. The admin panel is also very impressive, with a wide range of features that make it easy to manage and update the app.
Some other pros include:
- Beautiful skins that attract millions of players
- Multiple language support for quizzes
- A contest scoreboard where users can view their ranks and scores
- Referral link/code system for encouraging user engagement
- Redemption points for scoreboard entries
The app also supports OneSignal push notifications, allowing admins to send targeted updates to users. Admob is also integrated, allowing for banner, interstitial, and reward ads. Overall, the Quizzle app is a solid solution for anyone looking to build a quiz-based app with Material Design.
Cons
While the Quizzle app has many positives, I did encounter a few minor issues. Some may consider the code complexity high for beginners, especially if you’re new to PHP backend development. Additionally, there’s no documentation specific to Admob setup or Admob-related code for integration.
Overall Performance
The Quizzle app runs smoothly on both smartphones and tablets, with quick response times and a modern feel. The PHP server code is well-written, with clear comments and variables for easy understanding. For any issues or support queries, the provided README guide can be a huge help.
Conclusion
I highly recommend The Quizzle Android App for anyone interested in building a Material Design quiz-based app. While some may find the PHP code complex, the features, admin panel, Admob, and OneSignal integration make it well worth the effort. For Android Studio developers, the quick-and-easy setup makes this a great choice. As I give this app 8 out of 10 points, I strongly urge fellow developers to try this template and see how much of a difference it can make in their next quiz app project.
Additional Scores
- 2 out of 5 on support (no explicit email address or contact support button)
Recommendation
Overall, I’d definitely recommend this app for both novice and experienced Android app developers.
User Reviews
Be the first to review “The Quizzle Android App – PHP Backend + Admob + OneSignal”
Introduction
The Quizzle is a popular Android app that allows users to play a trivia game with a twist. It's a fun and engaging way to test your knowledge and compete with friends. In this tutorial, we'll show you how to create a PHP backend for The Quizzle app, integrate AdMob for in-app advertising, and utilize OneSignal for push notifications.
Prerequisites
Before we begin, make sure you have the following:
- A basic understanding of PHP and MySQL
- A computer with a PHP development environment (e.g. XAMPP)
- A MySQL database management system
- Android Studio installed on your computer
- A Google AdMob account
- A OneSignal account
Step 1: Create a PHP Backend
In this step, we'll create a PHP backend for The Quizzle app. We'll create a database to store user information, questions, and scores.
- Create a new folder for your project and create the following files:
config.php
: This file will contain database connection settings.database.php
: This file will contain database queries.user.php
: This file will contain user-related functions.question.php
: This file will contain question-related functions.score.php
: This file will contain score-related functions.
- In
config.php
, add the following code:<?php $db_host = 'your_host'; $db_username = 'your_username'; $db_password = 'your_password'; $db_name = 'your_database';
$conn = new mysqli($db_host, $db_username, $db_password, $db_name);
if ($conn->connect_error) { die("Connection failed: ". $conn->connect_error); } ?>
Replace `your_host`, `your_username`, `your_password`, and `your_database` with your actual database settings.
3. In `database.php`, add the following code:
```php
<?php
require_once 'config.php';
function createDatabase() {
$sql = "CREATE TABLE IF NOT EXISTS users (
id INT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255),
password VARCHAR(255)
);";
$sql.= "CREATE TABLE IF NOT EXISTS questions (
id INT PRIMARY KEY AUTO_INCREMENT,
question TEXT,
answer TEXT
);";
$sql.= "CREATE TABLE IF NOT EXISTS scores (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT,
score INT,
FOREIGN KEY (user_id) REFERENCES users(id)
);";
if ($conn->multi_query($sql)) {
echo "Database created successfully";
} else {
echo "Error creating database: ". $conn->error;
}
}
function insertUser($username, $password) {
$sql = "INSERT INTO users (username, password) VALUES ('$username', '$password')";
if ($conn->query($sql)) {
echo "User inserted successfully";
} else {
echo "Error inserting user: ". $conn->error;
}
}
function insertQuestion($question, $answer) {
$sql = "INSERT INTO questions (question, answer) VALUES ('$question', '$answer')";
if ($conn->query($sql)) {
echo "Question inserted successfully";
} else {
echo "Error inserting question: ". $conn->error;
}
}
function getScores() {
$sql = "SELECT * FROM scores ORDER BY score DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo $row['username']. ": ". $row['score']. "<br>";
}
} else {
echo "No scores found";
}
}
?>
This file contains functions to create the database tables, insert users and questions, and retrieve scores.
- In
user.php
, add the following code:<?php require_once 'database.php';
function authenticateUser($username, $password) { $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
return true;
} else {
return false;
}
}
function getUserScore($username) { $sql = "SELECT score FROM scores WHERE user_id=(SELECT id FROM users WHERE username='$username')";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
return $result->fetch_assoc()['score'];
} else {
return 0;
}
}
function updateScore($username, $score) { $sql = "UPDATE scores SET score=$score WHERE user_id=(SELECT id FROM users WHERE username='$username')";
if ($conn->query($sql)) {
echo "Score updated successfully";
} else {
echo "Error updating score: ". $conn->error;
}
} ?>
This file contains functions to authenticate users, retrieve user scores, and update scores.
5. In `question.php`, add the following code:
```php
<?php
require_once 'database.php';
function getQuestion() {
$sql = "SELECT * FROM questions ORDER BY RAND() LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
return $result->fetch_assoc();
} else {
return false;
}
}
function checkAnswer($question_id, $user_answer) {
$sql = "SELECT answer FROM questions WHERE id=$question_id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$correct_answer = $result->fetch_assoc()['answer'];
if ($user_answer == $correct_answer) {
return true;
} else {
return false;
}
} else {
return false;
}
}
?>
This file contains functions to retrieve a random question and check user answers.
- In
score.php
, add the following code:<?php require_once 'database.php';
function updateScore() { $sql = "INSERT INTO scores (user_id, score) VALUES ((SELECT id FROM users WHERE username='$_SESSION[username]'), 0)";
if ($conn->query($sql)) {
echo "Score updated successfully";
} else {
echo "Error updating score: ". $conn->error;
}
} ?>
This file contains a function to update the user's score.
**Step 2: Integrate AdMob**
In this step, we'll integrate AdMob into our PHP backend to display ads.
1. Create a new file called `admob.php` and add the following code:
```php
<?php
require_once 'config.php';
function showAd() {
$ad_unit_id = 'your_ad_unit_id';
$sql = "SELECT * FROM users WHERE id=(SELECT id FROM users WHERE username='$_SESSION[username]')";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$user_id = $result->fetch_assoc()['id'];
$ad_request = array(
'ad_unit_id' => $ad_unit_id,
'user_id' => $user_id
);
$ad_response = json_decode(admob_request($ad_request), true);
if ($ad_response['status'] == 'OK') {
echo '<div id="admob-ad"></div>';
echo '<script>admob.requestAd(admob.adUnitId, {"mediaviewport": true}, function(ad) {document.getElementById("admob-ad").innerHTML = ad;});</script>';
} else {
echo 'Error displaying ad: '. $ad_response['error'];
}
} else {
echo 'Error displaying ad: User not found';
}
}
function admob_request($ad_request) {
// Replace with your AdMob API key
$api_key = 'your_api_key';
$url = 'https://android.clients.google.com/serve/afm/'; // AdMob API URL
$headers = array(
'Content-Type: application/json',
'Content-Length: '. strlen(json_encode($ad_request))
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($ad_request));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Replace your_ad_unit_id
and your_api_key
with your actual AdMob settings.
- In
index.php
, add the following code:<?php require_once 'admob.php';
if (isset($_SESSION['username'])) { showAd(); } ?>
This will display the AdMob ad on the index page.
**Step 3: Integrate OneSignal**
In this step, we'll integrate OneSignal into our PHP backend to send push notifications.
1. Create a new file called `onesignal.php` and add the following code:
```php
<?php
require_once 'config.php';
function sendPushNotification($message, $users) {
$onesignal_app_id = 'your_onesignal_app_id';
$onesignal_api_key = 'your_onesignal_api_key';
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '. base64_encode($onesignal_app_id. ':'. $onesignal_api_key)
);
$url = 'https://onesignal.com/api/v1/notifications';
$data = array(
'app_id' => $onesignal_app_id,
'contents' => array(
'en' => $message
),
'included_segments' => array(
'All'
),
'filters' => array(
array(
'field' => 'user_id',
'key' => 'equals',
'relation' => '=',
'value' => $users
)
)
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Replace your_onesignal_app_id
and your_onesignal_api_key
with your actual OneSignal settings.
- In
index.php
, add the following code:<?php require_once 'onesignal.php';
if (isset($_SESSION['username'])) { $users = array($_SESSION['username']); sendPushNotification('Hello!', $users); } ?>
This will send a push notification to the user when they log in.
**Conclusion**
In this tutorial, we've created a PHP backend for The Quizzle app, integrated AdMob for in-app advertising, and utilized OneSignal for push notifications. We've also covered the basics of creating a database, inserting users and questions, and retrieving scores. With this tutorial, you should be able to create a fully functional Android app with a PHP backend.
Here is an example of a complete settings configuration for The Quizzle Android App - PHP Backend + Admob + OneSignal:
Admob Settings
<?xml version="1.0" encoding="utf-8"?>
<application
...>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511717" />
<meta-data
android:name="com.google.android.gms.ads.AD_UNIT_ID"
android:value="ca-app-pub-3940256099942544~947702733" />
<meta-data
android:name="com.google.android.gms.ads.MobileAds"
android:value="true" />
</application>
OneSignal Settings
<?xml version="1.0" encoding="utf-8"?>
<application
...>
<meta-data
android:name="ONESIGNAL_APP_ID"
android:value="Your-OneSignal-App-ID" />
<meta-data
android:name="ONESIGNAL_GOOGLE_PROJECT_NUMBER"
android:value="Your-Google-Project-Number" />
</application>
PHP Backend Settings
<?php
// Config.php
$db_host = 'Your-DB-Host';
$db_username = 'Your-DB-Username';
$db_password = 'Your-DB-Password';
$db_name = 'Your-DB-Name';
$api_key = 'Your-API-Key';
$secret_key = 'Your-Secret-Key';
PHP Backend API Endpoints
<?php
// api.php
function get_questions() {
// API endpoint to get questions
}
function submit_answer() {
// API endpoint to submit an answer
}
Android App Settings
// build.gradle
android {
...
defaultConfig {
...
applicationId "com.example.quizzle"
}
}
Android App Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest
...>
<application
...>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here are the features of the Quizzle Android App, extracted and formatted for easy reading:
Application Features:
- Android Studio Support with Material Design
- Quiz with time limit for each question
- Different Languages
- Contest Scorboard
- Referral link/code system
- Redeem referral points to scoreboard
- Scoreboard listing by rank & points
- OneSignal Push Notification
- Rate App, Share App, Contact Queries options
- Admob with Banner, Interstitial & Reward ads Integrated
- Manage Notification Configuration from Admin Panel
- Send notification through admin panel
- Change Banner/Interstital Ids from admin panel
- Enable/Disable Ads from Admin Panel
- Updates Control from Admin Panel (Force Update Module Added)
- Change Referral Points & Contest Settings from Admin Panel
- Android Code Migrated to AndroidX
- Android Studio Code (Recommended Android Studio Version – 3.3)
- Quick and Easy to Use
- Clean & Neat Code
Admin Panel Features:
- Simple and Attractive Admin Panel
- Powerful Controls
- Upload Bulk Questions
- Display Total Questions & Languages
- Easily Create New Contest
- Manage Contest Scoreboard
- Manage Users Referrals
- Manage Application Settings via API
- Full Application Control
- Send Notification from Admin Panel
- Clean & Neat Code
What You Get:
- Full Android Source Code
- Full PHP Server Code
- Full Documentation with Screenshots
- README
Let me know if you need any further assistance!
$35.00
There are no reviews yet.