Tuesday, November 20, 2018

Advertise advertisob

MEMASANG IKLAN PADA APK ANDROID


how to install AdMob ads on an android apk easily ,, just copy and paste the following code in your project ...

1. Create a new project ...
     Give a name (admob test) then create a package for example (com.admob.test)

2. Look for the abdroidmanifest.xml file
      Then copy the following code:
android:name="com.google.android.gms.ads.APPLICATION_ID"

            android:value="[ADMOB_APP_ID]"/>
        
3. look for the main.xml file then copy the following code


<com.google.android.gms.ads.AdView

            xmlns:ads="http://schemas.android.com/apk/res-auto"

            android:id="@+id/adView"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:layout_centerHorizontal="true"

            android:layout_alignParentBottom="true"

            ads:adSize="BANNER"

            ads:adUnitId="ca-app-pub-3940256099942544/6300978111">

        </com.google.android.gms.ads.AdView>



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools"         android:layout_height="match_parent"         android:layout_width="match_parent"         android:paddingLeft="@dimen/activity_horizontal_margin"         android:paddingRight="@dimen/activity_horizontal_margin"         android:paddingTop="@dimen/activity_vertical_margin"         android:paddingBottom="@dimen/activity_vertical_margin"         tools:context=".MainActivity">         <TextView android:text="@string/hello_world"             android:layout_width="wrap_content"             android:layout_height="wrap_content" />         <com.google.android.gms.ads.AdView             xmlns:ads="http://schemas.android.com/apk/res-auto"             android:id="@+id/adView"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_centerHorizontal="true"             android:layout_alignParentBottom="true"             ads:adSize="BANNER"             ads:adUnitId="ca-app-pub-3940256099942544/6300978111">         </com.google.android.gms.ads.AdView> </RelativeLayout>
4. Look for the MainActivity.java file then copy the following code



AdView adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");


Then the project builds and the ad testing appears or not, then the apk is ready to be published to Google Play. Good luck. . .

Hopefully useful we will provide further information about the world of techno ....

Thank you ...

No comments:

Post a Comment