Új hozzászólás Aktív témák
-
doc
nagyúr
valaki esetleg tudna segiteni AdMob ugyben?
Van egy C++ -ban megirt appom, es szeretnem valahogy odabiggyeszteni az AdMob reklamot.
Addig sikerult eljutnom, hogy a fokepernyom helyett egy fekete kepernyot kapok, alul egy pici szurke teglalappal a reklam helyen. Sajna Javaban nagyon gyer vagyok, szoval eleg nehezen haladok.Eddig ennyim van:
C++:
#ifdef __ANDROID__
#include "jni.h"
#include "android_native_app_glue.h"
void showAds()
{
JNIEnv *env = static_cast<JNIEnv*>(SDL_AndroidGetJNIEnv());
jobject activity = static_cast<jobject>(SDL_AndroidGetActivity());
jclass cls = env->GetObjectClass(activity);
jclass localcls = reinterpret_cast<jclass>(env->NewGlobalRef(cls));
jmethodID showAds = env->GetStaticMethodID(localcls, "showAdPopup", "()V");
env->CallStaticVoidMethod(localcls, showAds);
}
#endifJava:
// Our popup window, you will call it from your C/C++ code later
public static void showAdPopup()
{
//if(adsinited)
//{
// return;
//}
if(adView!=null) {
_activity.runOnUiThread(new Runnable() {
@Override
public void run() {
adsinited = true;
// Out popup window
popUp = new PopupWindow(_activity);
// This is the minimum size for AdMob, we need to set this in case our target device run at 320x480 resolution (Otherwise no ad will be shown, see the padding kill below)
popUp.setWidth(320);
popUp.setHeight(50);
popUp.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
popUp.setClippingEnabled(false);
layout = new LinearLayout(_activity);
mainLayout = new LinearLayout(_activity);
// The layout system for the PopupWindow will kill some pixels due to margins/paddings etc… (No way to remove it), so padd it to adjust
layout.setPadding(-5, -5, -5, -5);
MarginLayoutParams params = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 0, 0);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(adView, params);
popUp.setContentView(layout);
_activity.setContentView(mainLayout, params);
AdRequest adRequest = new AdRequest();
// Enable this if your are testing AdMob, otherwise you'll risk to be banned!
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
_activity.adView.loadAd(adRequest);
// Show our popup window
popUp.showAtLocation(mainLayout, Gravity.BOTTOM, 0, 0);
popUp.update();
}});
}
}
Új hozzászólás Aktív témák
- Apple iPhone 14 Pro Max 256GB, Kártyafüggetlen, 1 Év Garanciával
- iPhone 12 Pro 256GB Gold -1 ÉV GARANCIA - Kártyafüggetlen, MS3581
- Sima Vs.Windows Logitech Mx keys s plus és hagyományos Mx keys magyar bemutatása. Új videó linkkel
- Dell Precision 7550 i7-10850H 32GB 1TB Nvidia RTX3000 6GB 1 év garancia
- Dell Latitude 3310 13,3", Gold 5405U, 8GB RAM, SSD, jó akku, számla, 6 hó gar
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

