Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.shehabic:admobadapter:1.0'
}
dependencies {
implementation("com.github.shehabic:admobadapter:1.0")
}
<dependency>
<groupId>com.github.shehabic</groupId>
<artifactId>admobadapter</artifactId>
<version>1.0</version>
</dependency>
libraryDependencies += "com.github.shehabic" % "admobadapter" % "1.0"
:dependencies [[com.github.shehabic/admobadapter "1.0"]]
Admob Adapter is an Android library that makes it easy to integrate Admob native ads (both Express and Advanced) into ListView/RecyclerView
in the way that is shown in the following image/animation.
#Main features
Adapter
The admobadapter-sampleapp shows the available features and customizations.
##Cloning First of all you will have to clone the library.
git clone https://github.com/clockbyte/admobadapter.git
Now that you have the library you will have to import it into Android Studio. In Android Studio navigate the menus like this.
File -> Import Project ...
In the following dialog navigate to admobadapter-master
which you cloned to your computer in the previous steps and select the build.gradle
.
##Or you also can simply copy all the *.java from
admobadapter/admobadapter/src/main/java/com/clockbyte/admobadapter/
to your java
sources folder (feel free to edit the package names in all files but please leave the License header as is).
and all the *.xml from
admobadapter/admobadapter/src/main/res/layout/
to your res/layout
folder.
Also please don't forget to copy the string resource test_admob_unit_id
from admobadapter/admobadapter/src/main/res/values/strings.xml
to your strings.xml
file. Then kindly use it as demonstrated in the sampleapp demo.
When you'll be ready to deploy your app to Release you'll have to register in the Admob and create Ad unit ID there. Then you'd kindly replace the test_admob_unit_id
with your real Ad unit ID. And please don't forget to use the test ID instead of real one when you're debugging/testing your app otherwise Admob can ban your account (artificial inflating of impressions and so on).
#Base usage
The quick and dirty start is shown in the sampleapp of the project (to switch the sample between the RecyclerView and ListView examples kindly edit the AndroidManifest.xml
)
The Developer's guide on native ads could be found here.
The cook recipes could be found in the Wiki
Also feel free to ask me.
#Contributions Contributions are very welcome. If you find a bug in the library or want an improvement and feel you can work on it yourself, fork + pull request and i'll appreciate it much!