Categories

Follow Us @web_learners

Monday, September 14, 2020

How to Set App icon in Android App | Webview App Development Series Part 16

September 14, 2020 0 Comments

 Hi, In the last post we have learned how to make App and image fit in all screen sizes. Today we will learn how to Set App icon in Android App or Webview App.

First, you need to right-click on "App" then click on "New" then click on "Image Asset". Follow the below picture.


After that, go to the "Background Layer", then select the asset type, you can select the color or image as a background asset type, as your wish. I will use color, you can see in the below picture, you can select any color by click on the color code, then select Choose.



After that, go to the Foreground Layer, you can set your icon with your custom image or clip art or text. I will use my app logo so I will select image as an asset type. Then click on folder icon in Path.




Then you can resize so that the icon looks perfect. Click "Next".



After click next, it will show you how your app logo looks in the Google play store. Then click on the Finish button.



That's it, now run your project again, and you can check the app icon in the emulator, you will see the app icon. So we have successfully set our app icon.




You can also follow the video for better understanding.


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.

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.

Saturday, April 25, 2020

App Crash Without Any Error in Code || How to Fix || Android Studio || 2020

April 25, 2020 0 Comments
Hi, Is your Android App  or Webview App getting crash on Android Studio? Also, there is no error showing in the code? 

I am going to show the simplest and easiest way to finding the reason for app crashing and also the solution. For getting useful videos, Please subscribe to my youtube channel.


You can see in the above video, my app is crashing when I am running my Webview App on Android Studio. you can see no errors appear in my code, but my app is crashing. 

For finding the reason first click on the "Logcat" from the android studio, then you will see there is opened a window. There you will select your device, then select your project, then select the "Error".

You can see there is an "Underlined Blue color word", click on that it will show the file name and the code line number where you have an error. There will also show you the reason why your app is crashing. In my case, I have a problem in the "MainActivity.java" file on 125 number line code,  My Webview App is crashing for a null object reference.


Because I have taken a variable, but I have not initialized it in OnCreate, also I have not stored my layout design o that variable but I have written function using that variable, So it is showing null object reference. 

Now I will give the object reference on that function and then will run my project again. You can see in the video this time my Webview App is running perfectly, not crashing anymore. So I have solved my app crashing problem. You can solve find your app crashing reason and solve this way.

By the way, if you want to know in your app which code is executing, what is happening in your app. you can select Debug from the Logcat. You will be able to see everything there. See you in the next post. Thank you.

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

April 25, 2020 1 Comments
Hi Everyone, Today I am going to show you how to integrate Facebook SDK and Banner ads in the android app in the android studio.

In the Last post, I have shown how to create a Facebook business account for monetization android app. Also, we have added our app on Facebook, Added payment method, and created a banner ad unit. If you have not followed my Facebook Banner Ads integration in Android App Part 1 yet, then first complete part 1 then come to follow this post part 2. So let's start.


First, open your project with Android studio, Then go to your "build.gradle(Module: App)" file, then paste below facebook ad network dependency in the dependencies section.


Code:


Now in the "MainActivity.xml" file initialize the Facebook Ad network SDK.

Code:



Then move to the layout file "activity_main.xml" file and paste the below code, if you want to show your ads in the top of the page then paste this code above, and if you want to show your ads in the bottom of the page then paste below code bottom in the "activity_main.xml" file.



Code:


Now go to the "MainActivity.java" file, then take an AdView private variable
Code:


Then you need to paste the below code after initializing SDK code below:


Code:


To get test ads, add "IMG_16_9_APP_INSTALL#" to your placement id. Remove this when your app is ready to serve real ads.

Now you can run your project on Emulator or on your real devices. You can see there will be test ads.

if you want to run your project on Emulator, then add the below line. You will get the hashed ID that is printed to logcat when you first make a request to load an ad on a device.

Code:


After testing done, you need to remove that line also. So, before going to live your final code will be


That's it, We have successfully integrated Facebook Ads in our App. If you face any problem in coding, you can comment below. We will try our best to help you. Thank you.

Tuesday, April 21, 2020

Facebook Banner Ads integration in Android App Part 1 | Admob Alternative Ad network

April 21, 2020 0 Comments
Hi Everyone, is your AdMob account disabled or terminated? Don't worry you can use Admob alternative ad network like Applovin, Facebook, Unity, Leadbolt. I show you how to integrate these all Admob alternative ads in the android app.

Today I am going to you how to create a Facebook business account for managing monetization on the android app, Also how to add your first app in Facebook Ad Network for monetizing.

For Better understanding watch the below video and follow my step. And if you want to get more new helpful video please subscribe to my youtube channel. Let's start.



First, you need to go developers.facebook.com Then click on Login, if your computer has already logged in Facebook, then it will automatically create your Facebook developer account.



After that, you can see above have a drop-down button called "MyApps", click on that. You can see there will appear "Create app", click on that.



Then the "Create a New App ID" window will appear. There you have to give a name for app id, then contact email. After that click on "Create App ID". Then it will ask you a captcha security check.



Now your developer account and app id created. And you will see the window like the below picture. you can see in your window have an Audience Network setup option, click on "set up".


After click on "set up", Start Monetizing now this page will open. you need to click on the "Get Started" button.


if your Facebook account has already a business manager account then it will ask you to login with that account. 
For doing that you have to just select your business manager account, then click on "Next".


And you if don't have any Business account manager, in that case, click on "Create New Account". 


After that, It will show continue with your developer account. Click on the "Continue" button.



it will give you a form, there you have to fill Name, Email, Business Name, Country. After filling done, click on the "Next" button.


Then it will ask you to add your first app. There you have to write your app name. then click on the "Next" button.



After that you have to enter in your Gmail, Facebook will be sent you an email. You need to click on the "Confirm Now" button.



After that, you have to choose the platform. As my app is Android, so I will choose Android.


Then you will see there have two options, one is "App is live", another one is "App is not live". If you are already published in the google play store, then you need to enter your app URL, then click on the search icon.it will show your app. If your app has not published yet, then select "App is not live". But after published your app, you also need to enter your app URL. After that click on the "Submit" button. See the below image.



Now you can see your app is in Review, it will take 2-3 days to approve. The first step is completed, Now the second step is Ad format chooses, you can see there have Native, Native Banner, Banner, Interstitial, Banner, Medium Rectangle.


I will choose "Banner" Because I will integrate the Banner ad in my app. After selecting the ad format, you need to write a name for your banner ad unit id. I am giving the name "Banner". After that click on the "Create Placement" button. 


1st and 2nd step is successfully completed. For the third step, you need to click on that checkbox.


4th step: In the 4th step, you need to add your payment account. Click on the "Add Payment account" button". 


It will show you a form, you have to fill it. select account type "Individual", fill your country, address, phone number, etc. After filling the full form, click on the "Next" button.


Now this time you have to link your bank account. Fill the link bank form also. After that click on "Next".


After that, they will ask you to Review your Details. After reviewing click on the "Confirm" button.


Now you will see you are all set.


Now select your payment account, which you have just created. After that, click on the "Select " button.


So we have finished all the steps. 


In the next post, I will show you How to integrate Facebook Banner Ads in Android App. Thank you.