Mediation Admob with Mobfox - android

This my code for showing Ads Mobfox.
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView android:background="#d3d8c2"
android:padding="10dp"
android:fillViewport="true"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:background="#ffffff"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<!-- ads MobFox -->
<com.adsdk.sdk.banner.AdView android:layout_height="50dp"
android:layout_width="300dp"
adspaceWidth="320"
adspaceHeight="50"
adspaceStrict="true"
publisherId="MY_PUBLISHER_ID"
animation="true"
location="true"
request_url="http://my.mobfox.com/request.php"
android:id="#+id/mobFoxView"/>
<!-- End ads Mobfox-->
</LinearLayout>
</ScrollView>
I configure mediation Admob in control panel MobFox, but I want to know is what is necessary to add the code "xmlns:ads="http://schemas.android.com/apk/res-auto" ????

If you don't need to use the ads namespace then you don't need to include it. It doesn't appear that you need it, some don't

Related

Webview + ListView one overlays the other in Activity

So I'm having this XML File:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/wview"
android:orientation="vertical"
android:background="#android:color/black"
/>
<ListView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="#+id/viplist"
android:layout_below="#id/wview"
/>
</RelativeLayout>
Where the WebView is loading Text from my strings.xml, the text is formatted with HTML for a better displaying experience and is quiet long, so it doesn't fit on the display and the WebView is therefore scrollable.
Under the WebView(Text) I'm parsing a XML File with some data from the Internet which is displayed in a ListView.
So my problem is, that I can't get the ListView below my WebView plus I want to manage it like that: When I'm done scrolling in my WebView I want to show the ListView below. So the User has to go down the Text/WebView and then he can read the information from the ListView.
The App is basically describing a location and under the description there should be the list of dates when the location is available and when not. Just to get you an Idea of what I'm doing here.
you can use NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/wview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/black"
android:orientation="vertical" />
<ListView
android:id="#+id/viplist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/wview" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

Can't Identify which element is used....?

I've an android application, which set Location based reminders. After I added an alarm, it displays as following.
I can't understand which component is used to display the small map and text both. Also the small map has location which I've selected on the map. I'm developing similar application, and I want to use this type of display feature.
That looks like a Lite mode Google Map to me.
this video is the best explanation on the internet and covers the use case i think you are refering to.
https://youtu.be/N0N1Xkc_1pU
You can check out my answer to another similar question here: https://stackoverflow.com/a/39462819/3456841
Here's the google developers page on the topic
https://developers.google.com/maps/documentation/android-api/lite
Also here's a link to a demo activity that uses lite maps in a list
https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java
you probably want your list item layout file to look something like
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="#+id/map">
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/created_at"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"/>
</RelativeLayout>
Note the map:liteMode="true" in the map fragment declaration.

Setup the bottom of the page AdMob banner

I'm trying to setup an AdMob banner on the bottom of the page, but the Ad does not show.
Space appears the bottom of the page there, but the AdMob does not show there.
Add and reference the Google Play services library. - YES
Add a meta-data tag in AndroidManifest.xml. - YES
Declare com.google.android.gms.ads.AdActivity in the manifest. - YES
Set up network permissions in the manifest. - YES
Somebody tell me why.
Thank you.
My XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/flContainer" <!-- DATA Layout -->
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/ad_layout"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/ad_layout" <!-- AdMob Layout -->
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="vertical" />
</RelativeLayout>
MainActivity.java
// Create an ad.
adView = new AdView(context);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
// Add the AdView to the view hierarchy. The view
// will have no size
// until the ad is loaded.
LinearLayout layout = (LinearLayout) findViewById(R.id.ad_layout);
//layout.getBottom();
layout.addView(adView);
// Create an ad request. Check logcat output for the
// hashed device ID to
// get test ads on a physical device.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE").build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
You told fldContainer to matchParent. THis means it will consume all the space of the parent, leaving none for your ad.
Instead try:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/flContainer" <!-- DATA Layout -->
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/ad_layout" <!-- AdMob Layout -->
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="vertical" />
</LinearLayout>

Admob not showing in webview

My ads are not showing, i'm trying to add them in my webview application. This is the main.xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="a14f3ed10a5e4eb"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/webview"
android:layout_width="fill_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Any suggestion??
you have to give the Specific ID to the addMob. Just see the Default Example on GoogleAddMob site and follow that.
Use debug mode via Eclipse and launch and Sample Ad app from the developer.android.com. In LogCat search for "To get test" with Ctrl+F and you will see the id there.
Or check this link with detailed how to:
Get ad id how to

com.admob.android.ads.AdView unbound prefix?

I tried to include admob to an Android app in Eclipse. But I get an error in the layout.xml. Eclipse tells me that com.admot.android.ads.AdView is an unbound prefix. I have the admob library included in the build path, following the pdf instruction. But it still does not seem to find the AdView class. But why?
Here is the layout producing the error:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/renegrothmann.kalah"
android:layout_width="wrap_content" android:layout_height="wrap_content"
>
<renegrothmann.kalah.GameView
android:id="#+id/gameView" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="2px"
/>
<com.admob.android.ads.AdView
android:id="#+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
/>
</LinearLayout>
I had the same error wit this layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/topLayout"
>
<!-- Ad Placeholder -->
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a14df07c16f171a"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"
/>
</RelativeLayout>
Then I made it:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/topLayout"
>
<!-- Ad Placeholder -->
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a14df07c16f171a"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"
/>
</RelativeLayout>
Notice the second xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" in my RelativeLayout in the second example?
In fact if you remove the android namespace declaration xmlns:android="http://schemas.android.com/apk/res/android" it will start moaning about all the android components too.
Change the following
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/renegrothmann.kalah"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
by
<LinearLayout
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/renegrothmann.kalah"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
For me it's working with
<TableLayout
android:id="#+id/resultsuperlotto"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" />
Cheers!
Actually, you do not need to add xmlns:ads to a root element (or a parent element).
You can simply add xmlns:ads property to your AdView element, like:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
...>
</com.google.android.gms.ads.AdView>
Check this page.
Maybe you should replace "myapp" at the bottom with "app" or replace "xmlns:app" at the top with "xmlns:myapp". They should probably be the same.
I cannot provide a real answer, since actually I do not know, why it works now. What I did: I restarted with a fresh project. Sometimes, you simply go one wrong step!
Right Click your project, click Properties, click Android, on the Library panel click Add Button
and add both google-play-services_lib and appcompat_v7 libraries
Apply, Refresh, Clean under the Project.
If this doesn't work try the following:
Change the target line in project.properties as target=android-13
Right click on your project and Click Refresh
Click Clean under Project
Hope this will work.

Categories

Resources