Take a fresh look at your lifestyle.

How to Convert Website into Android Application step by step with addmob adds

0 13
Project Source code

Screen shot


Complete website convert into android app with Admob adds

1 step: create new project in android studio
2 step:Open activity_main.xml (or) main.xml,
create application interface and add webview element to it.

and copy paste code 

<RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android” xmlns:app=“http://schemas.android.com/apk/res-auto” xmlns:tools=“http://schemas.android.com/tools” xmlns:ads=“http://schemas.android.com/apk/res-auto” android:layout_width=“match_parent” android:layout_height=“match_parent” tools:context=“com.tech.dastgeer.dastgeertech.MainActivity”>
<WebView android:layout_below=“@+id/adView” android:id=“@+id/webview” android:layout_width=“match_parent” android:layout_height=“match_parent” >
</WebView>
<com.google.android.gms.ads.AdView xmlns:ads=“http://schemas.android.com/apk/res-auto” android:id=“@+id/adView” android:layout_width=“match_parent” android:layout_height=“wrap_content” android:layout_alignParentTop=“true” ads:adSize=“SMART_BANNER” ads:adUnitId=“ca-app-pub-6638829118614493/4690341639”>
</com.google.android.gms.ads.AdView>
</RelativeLayout>

Step 3:  Open MainActivity.java

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
public class MainActivity extends AppCompatActivity {
private AdView mAdView;
WebView webView;

 @Override 

public void onBackPressed() {

if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webview);
MobileAds.initialize(this,“ca-app-pub-6638829118614493~9779016782”);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(“https://dastgeertech.blogspot.com/”);
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
}

Step 4: Open AndroidManifest.xml file 
and give internet permission to it just after the package name. 
It is important because app data will load from website.


<uses-permission android:name=“android.permission.INTERNET”></uses-permission>
<uses-permission android:name=“android.permission.ACCESS_NETWORK_STATE”></uses-permission>

Step 5: openstrings.xml
change adunit id

<resources>
<string name=“app_name”>DastgeerTech</string>
<string name=“banner_ad_unit_id”>ca-app-pub-6638829118614493/4690341639</string>
<string name=“click_here”>click here</string>
</resources>

Step 6 : open the app-level build.gradle file for your app, and look for a “dependencies” section.

dependencies {
    implementation fileTree
(dir: 'libs', include: ['*.jar'])
    implementation
'com.android.support:appcompat-v7:26.1.0'
   
implementation 'com.google.android.gms:play-services-ads:15.0.0'}
Add the line in bold above

Click here :Website To Android App – Material Design | Full Applications With Admob

Send me an email when this page has been updated

Comments

0 comments

No Comments
  1. Mona martin says

    It turns out that even the hottest port has a few places where you can get off the beaten path. Here are some recommendations that will make you feel like you're in the know https://webceed.co.uk

  2. Muhammad Rafey says

    This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform! realizzazione e commerce san marino

  3. YK Agency says

    android app marketing Great article. Cool.

  4. graham says

    So I followed your directions: No success yet The app when loaded on a phone goes to open the closes. Cahned the admob codes and the website address which is travelsafe.talkoftravel.nz. What else needs to be changed to allow it to Convert Website Into Android Application?? appreciate some help as new to apps

Leave A Reply

Your email address will not be published.

%d bloggers like this: