From 54a171bd5e47b37ab03423d87a13142798df50e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 22 Oct 2018 15:16:39 +0200 Subject: [PATCH] ads --- android/app/build.gradle | 6 +-- android/app/src/main/AndroidManifest.xml | 2 + .../model/ServerCommunication.java | 2 +- .../view/NotificationsFragment.java | 7 +++ .../res/layout/fragment_notifications.xml | 53 ++++++++++++++----- android/build.gradle | 3 ++ 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7c3bc44..62e1160 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -39,13 +39,13 @@ dependencies { implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.recyclerview:recyclerview:1.0.0' - implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' + implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-messaging:17.3.4' - - implementation "android.arch.lifecycle:extensions:1.1.1" + implementation 'com.google.android.gms:play-services-ads:17.0.0' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.github.kenglxn.QRGen:android:2.5.0' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 734e376..ae5135f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -24,6 +24,8 @@ + + diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java index 0243684..acebde3 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java @@ -19,7 +19,7 @@ import okhttp3.ResponseBody; public class ServerCommunication { - public static final String BASE_URL = SCNApp.LOCAL_DEBUG ? "http://localhost:1010/" : "https://scn.blackforestbytes.com/"; + public static final String BASE_URL = /*SCNApp.LOCAL_DEBUG ? "http://localhost:1010/" : */"https://scn.blackforestbytes.com/"; private static final OkHttpClient client = new OkHttpClient(); diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java index b637cbf..46b73a2 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java @@ -6,6 +6,8 @@ import android.view.View; import android.view.ViewGroup; import com.blackforestbytes.simplecloudnotifier.R; +import com.google.android.gms.ads.doubleclick.PublisherAdRequest; +import com.google.android.gms.ads.doubleclick.PublisherAdView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; @@ -28,6 +30,11 @@ public class NotificationsFragment extends Fragment rvMessages.setLayoutManager(new LinearLayoutManager(this.getContext(), RecyclerView.VERTICAL, true)); rvMessages.setAdapter(new MessageAdapter(v.findViewById(R.id.tvNoElements))); + PublisherAdView mPublisherAdView = v.findViewById(R.id.adBanner); + PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build(); + mPublisherAdView.loadAd(adRequest); + return v; } + } diff --git a/android/app/src/main/res/layout/fragment_notifications.xml b/android/app/src/main/res/layout/fragment_notifications.xml index 423a252..ceb4966 100644 --- a/android/app/src/main/res/layout/fragment_notifications.xml +++ b/android/app/src/main/res/layout/fragment_notifications.xml @@ -3,20 +3,49 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:ads="http://schemas.android.com/apk/res-auto" tools:context=".view.NotificationsFragment"> - + android:layout_height="match_parent"> + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 2b01e45..b674840 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -18,6 +18,9 @@ allprojects { jcenter() maven { url "https://jitpack.io" } maven { url "https://dl.bintray.com/gericop/maven" } + maven { url "https://maven.google.com" } + + } }