BidVertiser

Categories

Follow Us @web_learners

BidVertiser

Monday, August 10, 2020

How to Show Exit Dialog in Android App || Exit Dialog on Home Screen

August 10, 2020 0 Comments

 Hi, In the previous post we have learned How to Show Exit Dialogue on Splash Screen in Webview App. Today we will learn How to show Exit Dialog in Home Screen (Main Activity). Let's Start.

As we will show Exit dialog in MainActivity.java, so we will set a function onBackPressed().In that onBackPressed() function we will take an if-else condition.

Code:


The "if" condition will be if our website or app can go back then it will go to the previous page,  else it will show Exit dialog. And in the exit dialog, there will be a message, such as "Do you want to Exit?" or anything you want to show to your users.


And there will also two buttons in the Exit dialog, One is the "Yes" button, another one is the "No" Button. Then we have to set "OnClickListener" on "Yes" and "No" both button. In that OnClickListener, we will define what will happen after the user clicks on buttons.


After that, we will set if the user clicks on the "yes" button app will Exit successfully. And if the users click on the "No" button the user will stay on the current page. Then have to show the alert dialog.


So all the code together will be:

Code:
 

And see the below code so that you can understand where you have put the above Exit Dialog code.


Code:
 


Now you can run your project. You can see below the image we have successfully added Exit dialog on Home Screen. Exit dialog working perfectly.


That's it. Thank you.

Monday, August 3, 2020

How to solve Manifest merger failed problem in Android Studio

August 03, 2020 0 Comments
Hi, In the last post we have learned that How to Restore Suspended Webview Apps on Google Play. Today we are going to learn How to solve "Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-20:19 to override." problem in Android Studio.



For solving the Manifest merger failed problem,  it has two methods to solve it.  Two methods are below:

The first method is:
1. Migrate your project to AndroidX project.

The second method is:
2. Don't need to Migrate the project to the AndroidX project. Write code in the Manifest file.

How to Migrate your project to AndroidX project

If you are using old android studio libraries then you have to migrate your project to the AndroidX project. For migrating to the AndroidX project you have to add the following two lines into the "Gradle.properties" file in android studio.
Code:
 
First, go to the "Gradle.properties" file, then paste the above two lines. then click on "Sync Now" See the below images for better understanding.



 or you can migrate your project following way also. First, click on Refactor from the above menu in Android studio. Then select on Migrate to AndroidX. 

After that you will get a confirmation window, you need to click on migrate. It will ask you to do backup your project before migrating to AndroidX.you should do the backup. Then it will migrate your project to AndroidX.



Second Method:

If you don't want to migrate your project to the AndroidX project, you can follow this second method for migrating to the AndroidX project. You need to just write below two lines of code in the Manifest file in the Android studio.
Code:
 

See below image:




After that just "Sync" your project. You will see the error is gone. That's it. Thank you.

The video tutorial of  "How to solve Manifest merger failed problem in Android Studio" is here


Friday, July 24, 2020

How to Restore Suspended Apps on Google Play || How to Solve Webview and Affiliate Policy Violation

July 24, 2020 2 Comments
Hi, Today we are going to see how can we solve Webview and Affiliate Policy Violation on App in the Google Play store.  Also you will learn How can you declare webview ownership on Google play console and publish your webview application. Let's start.

When your app will be suspended on google play store, the google play support team will send you an email about the reason for suspension. Like the below image.




In that email, you will see an option for contact with the support team for appeal.


As you see in the above image, my Webview App was suspended for Webviews and Affiliate Spam policy. First, you have to click on the support policy team. After clicking that you will get a form, there you have to 



In that form, First, click on check option, And First name, last name, primary email, and package name will automatically fill up, then you have to describe why they should remove the suspension, then you have to select the first option, then click submit. see the below image.


After submitting the form, they will send you an email for confirming you that they got an appeal from you successfully.


After 3-7 days later you will get an email from them again. In that email, they will give enough information about why they did suspension and what you should do for the removal of suspension.


As you can see my app suspended for webview and affiliate policy violation, they said if you are the owner of that website, then submit the screenshot of the website domain console.


After submitting the document they will remove the suspension from your Webview App and will send you a confirmation email. 


Then you have to update the app on Google Play Console. You can see my Webview App is now live on Google Play store. They Removed the suspension.



That's it. Thank you.

Monday, May 18, 2020

Facebook Native Banner Ads Integration in Android App | Admob Alternative Ad network

May 18, 2020 2 Comments
Hi, Today I am going to show you How to integrate Facebook Native Banner Ads in Android App. In the last post, I have shown you how to integrate Facebook Banner Ads in Android App. Let's start.


First, add the below dependency in build.gradle(Module: App) for importing Facebook ads SDK.


Code:




And then move to the activity_main.xml file, then paste the below layout code.




Code:


It will show your ad bottom of the screen if you want to show your ad Top of the screen you need to write android:layout_alignParentBottom="true". 

Then you have to create a new layout for your Native Banner Ad, named it native_banner_ad_layout.xml 



Then paste the below code in native_banner_ad_layout.xml file.


Code:


So the final full code will be in activity_main.xml file is as follows:


Code:





Now move to the MainActivity.java file, first import the Facebook ads SDK write the following code.


Code:


Then paste the below code above Oncreate.


Code:


Now initialize the Facebook SDK in Oncreate.

Code:


Then create NativeBannerAd object, set an AdListener, then retrieve the "Native Banner Ad's" properties and display it in onAdLoaded() method. It will display the ad once it is loaded successfully. After that call loadAd() after AdListener in your Activity as follows.



Code:


Then paste the following code in your activity after Oncreate.


Code:


So the final code will be in your java activity file is as follows:



Code:


Now if you run your App you will see the Native Banner ad.





That's it. Thank you.

Sunday, May 17, 2020

Facebook Interstitial Ads Integration in Android App | Admob Alternative Ad network

May 17, 2020 0 Comments
Hi, Today I am going to show you How to integrate Facebook Interstitial Ads in the Android app.
In the next post, I will show you How to integrate Facebook Native banner Ads in the Android app.


First, add the below dependency in build.gradle(Module: App) for importing Facebook ads SDK.


Code:




And then move to the MainActivity.java file, take an InterstitialAd variable called interstitialAd.





After that, you have to initialize the SDK in Oncreate.








And then need to initialize that  InterstitialAd variable with your Interstitial Placement ID. Then load an ad.


Code:


Then you can setAdListener and call interstitialAd.show for showing your Interstitial Ad.


Code:




Then you call loadad() for loading an interstitial ad.



That's it. After publishing your app in the google play store, you will see your Interstitial ad is showing in your app. Thank you.

Buy traffic for your website

Wednesday, May 13, 2020

How to Make images fit in all Screen Sizes | Webview App Development Series Part 15

May 13, 2020 0 Comments
Hi, Last post I have shown you How to Make Android App or Webview App fit all Screen Sizes. Today I am going to show you How to Make images fit in all Screen Sizes. Let's Start.



Usually, the display of mobile devices becomes small, normal, large, x-large. For fitting all these screen sizes, you need to also give these sizes of images. For doing this I will use the software, you can Download image Resizer


In the software First, you have to select the size format from the left side, such as mdpi, hdpi, xhdpi, tvdpi etc. then you need to select drawable from the drop-down menu. 

And then have to select the destination where you want to save the picture. And then drop your image. After resizing copy all the image folder and paste it in the drawable folder in Android studio. Please watch the above video and follow my step.


Monday, April 27, 2020

How to Make Android App fit all Screen Sizes | Webview App Development Series Part 14

April 27, 2020 1 Comments
Hi, Today I am going to show How to Make Android App fit all Screen Sizes. Last Post I have shown you How to Integrate Admob ads in Webview. Let's Start.



First, you have to go to the "AndroidManifest.xml" file for giving permission to Make Android App fit all Screen Sizes. Usually, the display of the mobile becomes small, normal, large, x-large. So, we will give all-screen supports permission. Write the following code.

Code:


Then you have to Make different files for different sizes of the display. Like in my project have a splash screen, I will make different activity file for different display sizes.

First, you have to click on the right side of the mouse, then select new-->Layout Resource File. Also, you have to give the exact same name which name has your default activity.xml file. In my case, my file name is "activity_splash.xml" in Webview App. I will provide that name in the file name scope, As you can see my splash screen has "RelativeLayout" so I have selected Root element RelativeLayout.

Then you can see on the left side has a "size" option, you need to click on that. you will see there has Small, Normal, Large, X-Large option. You have select which size you want. Then click on OK.


This way create other files. And for the landscape mode, you need to create also the same way but have written there "land" such as layout-small-land.


If you want to create a screen for a tablet, then you need to write layout-sw600dp. 600 dp used for small to 7-inch tablet screen support, for 10-inch or higher screen you need to create the same way 720dp.



Then copy the code from the original activity file, then paste the code in all the activity files in your Webview App

That's it. In the next video, the second part will be discussed which is about image fitting in Webview App according to the activity we have created here. If you face still a problem, Watch the video above and follow my guidelines. Thank you.