Android Important Things
add lottie
animation to android studio :
implementation
'com.airbnb.android:lottie:$lottieVersion'
https://github.com/airbnb/lottie-android
add sdm
responsive size to android studio :
implementation 'com.intuit.sdp:sdp-android:1.1.0'
activity
result api
implementation
"androidx.activity:activity:1.4.0"
implementation
"androidx.fragment:fragment:1.6.0"
permission
check
https://github.com/Karumi/Dexter
image slider
library
https://github.com/denzcoskun/ImageSlideshow
bottom bar
animation library
implementation
'nl.joery.animatedbottombar:library:1.1.0'
Using ads
Add in
gradle
implementation 'com.google.android.gms:play-services-ads:22.6.0'
add in
manifest file value = app id
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
Add this in
app lunch mean MainActivity.java
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
});
InterstitialAd
InterstitialAd.load(this,"ca-app-pub-3895743165117452/3364814723", adRequest,
new InterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
// The mInterstitialAd reference will be null until
// an ad is loaded.
mInterstitialAd = interstitialAd;
Log.i(TAG, "onAdLoaded");
mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){
@Override
public void onAdClicked() {
// Called when a click is recorded for an ad.
Log.d(TAG, "Ad was clicked.");
}
@Override
public void onAdDismissedFullScreenContent() {
// Called when ad is dismissed.
// Set the ad reference to null so you don't show the ad a second time.
Log.d(TAG, "Ad dismissed fullscreen content.");
mInterstitialAd = null;
}
@Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
// Called when ad fails to show.
Log.e(TAG, "Ad failed to show fullscreen content.");
mInterstitialAd = null;
}
@Override
public void onAdImpression() {
// Called when an impression is recorded for an ad.
Log.d(TAG, "Ad recorded an impression.");
}
@Override
public void onAdShowedFullScreenContent() {
// Called when ad is shown.
Log.d(TAG, "Ad showed fullscreen content.");
}
});
if (mInterstitialAd != null) {
mInterstitialAd.show(MainActivity.this);
} else {
Log.d("TAG", "The interstitial ad wasn't ready yet.");
}
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
// Handle the error
Log.d(TAG, loadAdError.toString());
mInterstitialAd = null;
super.onAdFailedToLoad(loadAdError);
}
});
Image slider
https://github.com/denzcoskun/ImageSlideshow
Comments
Post a Comment