Skip to content

Instantly share code, notes, and snippets.

// Gdzieś gdzie inicjalizujemy reklamy od Google
adMobView.AdListener = new CustomAdListener();
public class CustomAdListener : AdListener
{
public override void OnAdFailedToLoad(int errorCode)
{
LoadTappxAd();
}
<com.tappx.sdk.android.TappxBanner
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:txAppKey="/xxxxxxxxxxxxx/Pub-xxxx-Android-xxxx"
/>
var tappxAd = new TappxBanner(this, "/xxxxxxxxxxxxx/Pub-xxxx-Android-xxxx");
tappxAd.SetAdSize(TappxBanner.AdSize.BANNER320x50);
layout.AddView(tappxAd); // Dodaj banner do widoku, w którym chcesz go wyświetlać
tappxAd.LoadAd();
// W miejscu gdzie tworzymy banner Tappx
tappxAd.SetListener(new CustomTappxBannerListener());
public class CustomTappxBannerListener : Java.Lang.Object, ITappxBannerListener
{
public void OnBannerClicked(TappxBanner p0)
{
}
public void OnBannerCollapsed(TappxBanner p0)
internal Task CurrentNavigationTask { get; set; }
public async Task<Page> PopAsync(bool animated)
{
if (CurrentNavigationTask != null && !CurrentNavigationTask.IsCompleted)
{
var tcs = new TaskCompletionSource<bool>();
Task oldTask = CurrentNavigationTask;
CurrentNavigationTask = tcs.Task;
await oldTask;
#if DEBUG
string my_key = "my_debug_key";
#elif
string my_key = "my_production_key";
#endif
<Reference Include="Xamarin.GooglePlayServices.Ads, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.GooglePlayServices.Ads.42.1021.1\lib\MonoAndroid70\Xamarin.GooglePlayServices.Ads.dll</HintPath>
</Reference>
Condition="'$(Configuration)' != 'ReleaseAmazon'"
<Reference Include="Xamarin.GooglePlayServices.Ads, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)' != 'ReleaseAmazon'">
<HintPath>..\..\packages\Xamarin.GooglePlayServices.Ads.42.1021.1\lib\MonoAndroid70\Xamarin.GooglePlayServices.Ads.dll</HintPath>
</Reference>
<Import Project="..\..\packages\Xamarin.GooglePlayServices.Ads.42.1021.1\build\MonoAndroid70\Xamarin.GooglePlayServices.Ads.targets" Condition="Exists('..\..\packages\Xamarin.GooglePlayServices.Ads.42.1021.1\build\MonoAndroid70\Xamarin.GooglePlayServices.Ads.targets') And '$(Configuration)' != 'ReleaseAmazon'" />