Four in row Master (Admob + GDPR + Android Studio)
$16.00
7 sales
Review: Four in Row Master (Admob + GDPR + Android Studio)
Introduction:
The Four in Row Master (Admob + GDPR + Android Studio) is an Android project that provides an easy-to-use and customizeable game development platform for beginners. With its built-in Admob integration and GDPR compliance, this project is perfect for developers looking to create a engaging and revenue-generating game for Android devices.
Pros:
- Easy to use: The project comes with a user-friendly interface that makes it easy to customize and reskin the game.
- Admob integration: The project includes Admob ads, allowing developers to monetize their game and increase revenue.
- GDPR compliance: The project is designed to comply with the General Data Protection Regulation (GDPR), ensuring that developers can create games that are compliant with EU regulations.
- Support for Android 12: The project is built using Android Studio Arctic Fox, making it compatible with the latest Android 12 operating system.
- 64-bit APK: The project is built as a 64-bit APK, making it compatible with both ARM and x86 devices.
Cons:
- Limited customization options: While the project is easy to customize, the options may be limited for more experienced developers looking for advanced customization.
- No support for Unity or Buildbox: The project is specifically designed for Android Studio, so developers who prefer using Unity or Buildbox may need to look elsewhere.
Features:
- Designed for tablets and phones
- APK 64 Bits – Android 12 ready
- Supports both APPLIANCES ANDROID ARM & x86
- Admob Ads: Banner and Interstitials
- Change package name
- Change graphics game
- Change audio game
- Change Admob Banner and Interstitial ID
- Change Your Privacy policy, and review Url (GDPR)
Conclusion:
The Four in Row Master (Admob + GDPR + Android Studio) is an excellent choice for beginners looking to create a customizable and revenue-generating game for Android devices. With its easy-to-use interface, Admob integration, and GDPR compliance, this project is a great starting point for developers new to Android game development. While the customization options may be limited, the project’s compatibility with Android 12 and 64-bit APK makes it a great choice for developers looking to create games for the latest Android devices.
Rating: 4.5/5
User Reviews
Be the first to review “Four in row Master (Admob + GDPR + Android Studio)”
Introduction
Welcome to this comprehensive tutorial on building a Four in a Row game using Android Studio, AdMob, and handling GDPR compliance. In this tutorial, we will create a game that allows two players to play against each other, with the goal of getting four of their markers in a row. The game will be integrated with AdMob for displaying advertisements, and we will implement GDPR compliance to ensure we are following the latest EU regulations.
Prerequisites
Before starting this tutorial, make sure you have the following:
- Android Studio installed on your computer
- Basic knowledge of Java programming
- Android SDK installed on your system
- A Google account for AdMob
- A physical Android device for testing
Step 1: Creating the New Project
Open Android Studio and create a new project by selecting "File" > "New" > "New Project". In the "New Project" dialog, select "Android" as the project type, and then select "Empty Activity" as the template. Name your project "FourInARow" and click "Finish".
Step 2: Designing the Layout
Open the "activity_main.xml" file located in the "res/layout" directory. This is where we will design our game board. Add a 7x6 table layout to the file:
<?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="match_parent"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button6"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
<Button
android:id="@+id/button7"
android:layout_width="0dp"
android:layout_height="80dp"
android:text="Button" />
</TableRow>
<!-- Repeat the above row 5 more times -->
</TableLayout>
<Button
android:id="@+id/btn_new_game"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Game" />
</LinearLayout>
Step 3: Creating the Game Logic
Create a new Java file called "GameLogic.java" and add the following code:
public class GameLogic {
private Button[][] board;
private int[][] winningCombinations;
private int currentPlayer;
private boolean gameOver;
public GameLogic() {
board = new Button[7][6];
winningCombinations = {{0, 1, 2, 3}, {1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}, {0, 1, 4, 7}, {1, 2, 5, 7}, {2, 3, 6, 7}, {0, 4, 5, 7}};
currentPlayer = 1;
gameOver = false;
}
public void initButtonArray(Button[][] boardButtons) {
board = boardButtons;
}
public void handleClick(View view) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (board[i][j] == view) {
if (!board[i][j].isEnabled()) {
return;
}
board[i][j].setEnabled(false);
if (board[i][j].getTag() == null) {
board[i][j].setTag(String.valueOf(currentPlayer));
checkForWin();
} else {
if (Integer.parseInt(board[i][j].getTag().toString()) == 1) {
currentPlayer = 2;
} else {
currentPlayer = 1;
}
}
checkForWin();
checkForDraw();
break;
}
}
}
}
private void checkForWin() {
for (int[] combination : winningCombinations) {
if (board[combination[0]][combination[1]].getTag().toString().equals(String.valueOf(currentPlayer)) &&
board[combination[1]][combination[2]].getTag().toString().equals(String.valueOf(currentPlayer)) &&
board[combination[2]][combination[3]].getTag().toString().equals(String.valueOf(currentPlayer))) {
gameOver = true;
}
}
}
private void checkForDraw() {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (!board[i][j].isEnabled()) {
return;
}
}
}
gameOver = true;
}
public boolean isGameOver() {
return gameOver;
}
}
Step 4: Integrating AdMob
Create a new Java file called "AdMob.java" and add the following code:
public class AdMob {
private Activity activity;
private InterstitialAd interstitialAd;
private RewardedVideoAd rewardedVideoAd;
private boolean isInitialized;
public AdMob(Activity activity) {
this.activity = activity;
isInitialized = false;
}
public void initAdMob() {
MobileAds.initialize(activity, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete() {
isInitialized = true;
loadInterstitialAd();
loadRewardedVideoAd();
}
});
}
private void loadInterstitialAd() {
interstitialAd = new InterstitialAd(activity);
interstitialAd.setAdUnitId("INSERT_INTERSTITIAL_AD_UNIT_ID_HERE");
AdRequest adRequest = new AdRequest.Builder().build();
interstitialAd.loadAd(adRequest);
}
private void loadRewardedVideoAd() {
rewardedVideoAd = new RewardedVideoAd(activity);
rewardedVideoAd.setRewardedVideoAdUnitId("INSERT_REWARDED_VIDEO_AD_UNIT_ID_HERE");
AdRequest adRequest = new AdRequest.Builder().build();
rewardedVideoAd.loadAd(adRequest);
}
public void showInterstitialAd() {
if (interstitialAd.isLoaded() && isInitialized) {
interstitialAd.show();
}
}
public void showRewardedVideoAd() {
if (rewardedVideoAd.isLoaded() && isInitialized) {
rewardedVideoAd.show();
}
}
}
Step 5: Implementing GDPR Compliance
Create a new Java file called "GDPR.java" and add the following code:
public class GDPR {
private final String[] permissions = {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
};
public boolean checkSelfPermission(Context context, String permission) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
} else {
return true;
}
}
public void requestPermissions(Context context, String[] permissions, int requestCode) {
ActivityCompat.requestPermissions((Activity) context, permissions, requestCode);
}
}
Step 6: Integrating GDPR with AdMob
Open the "AdMob.java" file and add the following code:
public class AdMob {
//...
private GDPR gdpr;
public AdMob(Activity activity, GDPR gdpr) {
this.activity = activity;
this.gdpr = gdpr;
isInitialized = false;
}
public void initAdMob() {
MobileAds.initialize(activity, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete() {
isInitialized = true;
loadInterstitialAd();
loadRewardedVideoAd();
}
});
}
//...
public void showInterstitialAd() {
if (interstitialAd.isLoaded() && isInitialized && gdpr.checkSelfPermission(activity, permissions[0]) && gdpr.checkSelfPermission(activity, permissions[1])) {
interstitialAd.show();
}
}
public void showRewardedVideoAd() {
if (rewardedVideoAd.isLoaded() && isInitialized && gdpr.checkSelfPermission(activity, permissions[0]) && gdpr.checkSelfPermission(activity, permissions[1])) {
rewardedVideoAd.show();
}
}
}
Step 7: Creating the Game
Open the "MainActivity.java" file and add the following code:
public class MainActivity extends AppCompatActivity {
private AdMob adMob;
private GameLogic gameLogic;
private Button[][] boardButtons;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adMob = new AdMob(this, new GDPR());
adMob.initAdMob();
gameLogic = new GameLogic();
boardButtons = new Button[7][6];
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 6; j++) {
boardButtons[i][j] = findViewById(getResources().getIdentifier("button" + (i * 6 + j + 1), "id", getPackageName()));
gameLogic.initButtonArray(boardButtons);
}
}
findViewById(R.id.btn_new_game).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gameLogic.gameOver = false;
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 6; j++) {
boardButtons[i][j].setEnabled(true);
}
}
}
});
findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gameLogic.handleClick(v);
}
});
// Add listeners for the rest of the buttons
}
}
Conclusion
In this tutorial, we have created a complete Four in a Row game with AdMob integration and GDPR compliance. We have implemented the game logic using a 7x6 table layout, and handled user input using a listener. We have also initialized AdMob and checked for permissions before showing advertisements. Finally, we have tested the game on a physical Android device.
Admob Configuration
To configure Admob in your Four in row Master game, follow these steps:
- Create a new Admob account or login to your existing one.
- Create a new ad unit for each ad type you want to display (e.g. interstitial, rewarded video, banner).
-
In your Android Studio project, go to the
res/values/strings.xml
file and add the following code:<string name="admob_app_id">YOUR_APP_ID_HERE</string> <string name="admob_interstitial_ad_unit_id">YOUR_INTERSTITIAL_AD_UNIT_ID_HERE</string> <string name="admob_rewarded_video_ad_unit_id">YOUR_REWARDED_VIDEO_AD_UNIT_ID_HERE</string> <string name="admob_banner_ad_unit_id">YOUR_BANNER_AD_UNIT_ID_HERE</string>
Replace
YOUR_APP_ID_HERE
,YOUR_INTERSTITIAL_AD_UNIT_ID_HERE
,YOUR_REWARDED_VIDEO_AD_UNIT_ID_HERE
, andYOUR_BANNER_AD_UNIT_ID_HERE
with your actual Admob app ID and ad unit IDs. - In your
MainActivity.java
file, add the following code:import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.RequestConfiguration;
MobileAds.initialize(this, "YOUR_APP_ID_HERE");
Replace `YOUR_APP_ID_HERE` with your actual Admob app ID.
**GDPR Configuration**
To configure GDPR in your Four in row Master game, follow these steps:
* In your `res/values/strings.xml` file, add the following code:
true
We use cookies to provide you with a better user experience.
* In your `MainActivity.java` file, add the following code:
import com.appodeal.ads.GDPR;
GDPR.getInstance().setConsentRequired(true); GDPR.getInstance().setConsentSummary("We use cookies to provide you with a better user experience.");
* In your `manifest.xml` file, add the following code:
**Android Studio Configuration**
To configure Android Studio for your Four in row Master game, follow these steps:
* Create a new Android project in Android Studio.
* In the `build.gradle` file, add the following code:
dependencies { implementation 'com.google.android.gms:play-services-ads:20.0.0' implementation 'com.google.android.gms:play-services-gcm:20.0.0' }
* In the `res/values/strings.xml` file, add the following code:
Four in row Master
1.0
* In the `AndroidManifest.xml` file, add the following code:
<application ... android:label="@string/app_name" android:versionCode="1" android:versionName="@string/app_version"> ...
Here are the features and information extracted from the content:
Features:
- Designed for tablets and phones.
- APK 64 Bits - Android 12 ready.
- Supports both APPLIANCES ANDROID ARM & x86.
- Admob Ads: Banner and Interstitials.
How to:
- Open Project Into Android Studio.
- Change the package name.
- How to Change Graphics game.
- How to Change Audio game.
- How to change the Admob Banner and Interstitial ID.
- Change Your Privacy policy, and review Url. (GDPR)
More Games:
- Car Driver Admob GDPR Android Studio
- Cling Admob GDPR Android Studio
- Knife Pirate Admob GDPR Android Studio
- Basketball Admob GDPR Android Studio
- Parcheesi Ludo Android Studio Admob GDPR
- Zumbla Deluxe Admob GDPR Android Studio
- Domino Party Admob GDPR Android Studio
- Knife Admob GDPR Android Studio
- Parcheesi Ludo Android Studio Admob GDPR
- Bubble Frozen Admob GDPR Android Studio
- Puzzle Blocks Forest Admob GDPR Android Studio
- Rummy Classic Rami Admob GDPR Android Studio
- Poker Admob GDPR Android Studio
- Escape Maze Admob GDPR Android Studio
- Block Puzzle Wild Admob GDPR Android Studio
- Block Puzzle Admob GDPR Android Studio
- Checkers Dames
- Kasparov Chess
- Ghost Admob GDPR Android Studio
- Ball Physics Admob GDPR Android Studio
- Rectangle Max V2 Admob GDPR Android Studio
- Snake vs Block Admob GDPR Android Studio
Note: Each featured game has its own link to purchase.
$16.00
There are no reviews yet.