ads for multi-platform avalonia (or Android at least xD)

Hi!, I'm very very new to all this xD and while I worked with WPF, this is my first time uploading something... So, I've made this Multiplatform App in AvaloniaUI, and I am focusing right now on the Android side of it, I'm about to publish (today hopefully) the app in the Play Store, but I have no idea how to add ads to it... I was thinking on a simple banner somewhere in the bottom of the app, so I can pay for servers/services and the app would be self maintained, but... all the explanations, tutorials, etc are targeted for Android specific platforms, which, I never used, so while Avalonia has access to this code implementations, I have no idea what half of what I'm reading means... As an example, admob has an SDK... in step one of the guide it sais "In your Gradle settings file, include the Google's Maven repository and Maven central repository" and then there are two explanations that say "Kotlin" and "Groovy"... I have no idea what ANY of this means, I tried finding what Gradle is, and seems like it is an actual file, which I also don't have in my project for some reason, I have no idea how to get or access those repositories, it mentions... I'm really lost, I've been trying to do this for a while now.. first trying to find an ad service which used paypal, cos I'm not from the US, so paypal was the best way of managing the exchange from dollars to pesos by myself, but I can't understand any of the different services explanations, they don't seem to focus on c# implementations on their mini guides... Does anyone has a good tutorial that I could follow step by step that is specifically targeting dot net? Anything helps, I'm truly lost here 😦 I don't even care which service it is, I'll take any ad service at this point xD
12 Replies
canton7
canton72mo ago
I think you'll have the most success starting with how to include native android libs in an avalonia-android app I've not tried to go down that rabbit hole myself, but you should start learning how to take an android library and include it inot the android targetting-project of your avalonia app. From there, it should be clearer how to integrate the specific native adlib library
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
Thanks, I've been trying a million things today, I got to a point where the app doesn't crash anymore using Jc.AdMob.Avalonia, but it also doesn't show any ads... implementation wise seems to have everything the guide sais, the main nuget package, and the specific ones for Android and iOS (which I only care for the Android one), I've set the initialization, and ".useAdMob" on the CustomizeAppBuilder thing, and I've added the xaml element corresponding to a Banner... Then I added the AppId from my admob App Id, and the Test string for the actual banner... nothing, it doesn't show... Then I searched for any other solution, any other wrapper, for any other ad service... no one mentions Avalonia, and all implementations and guides are explained in JavaScript, or some other languages, but not in c#, and english is not my main language, so this is double effort for me... I just don't know what else to do 🤷‍♂️
Pobiega
Pobiega2mo ago
Gradle is a build tool for Java and JVM apps. Kotlin is a JVM programming language. Groovy is another JVM programming language.
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
Thanks, so... there is no ad service for dot net? has anyone manage to find ANY?
canton7
canton72mo ago
You should be able to use the Android one without too much trouble?
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
the Java one? I found an AdMob API for net8, but no SDK (?) the API is mostly to manage my AdMob Account, but doesn't seem to handle showing the ads, only... my account not sure of any others, I can't find anything on my searches (I've been on and off for the past two months, and non stop since yesterday, and I can't seem to figure out how to get the SDK for net8, the tutorial tells you to add some services on Gradle, but my project doesn't have that) and again, I don't care which service, I'm just using AdMob as an example, I just want any ad service 🤣
canton7
canton72mo ago
Yes, the java one. You're building a java app, after all Cross-platform libraries which end up running on Android end up building an Android application at the end of the day, and they normally have a way to let you write Android-specific bits of your application
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
I see.. yes, I have a specific android project, based on net8-android... I had no idea I had a way to write in Java in there, as everything seems to be in c#, even the MainActivity is in c#
canton7
canton72mo ago
From a very quick google, it looks like Avalonia/Android apps have a native project (which targets net8.0-android or similar), then see https://learn.microsoft.com/en-us/dotnet/android/binding-libs/binding-java-libs/binding-java-maven-library From a quick read, it looks like that generates a bunch of C# bindings for the java library, which you can then call from C#?
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
I did not think of searching for that :PepeGiveUp: I searched all kind of things, but... not how to implement java on it... I thought it was not a possiblity... thanks... I will research that then and try to find a way to implement it that way.. I'm so exhausted :PepeCry:
canton7
canton72mo ago
I mean, https://www.google.com/search?q=.net+android+use+java+library brings up a bunch of useful links too' https://docs.avaloniaui.net/docs/guides/platforms/platform-specific-code/dotnet strongly indicates that you can call java code from your Avalonia app, and mentions e.g. net8.0-android, although it doesn't mention native libraries at all
𝗮𝗪𝗶𝗹𝗱(ish)𝗧𝗼𝗺𝗺𝗮𝘀 🐒
I'll check all this, thanks, this opens up A LOT more to learn... which... means a lot of time... which... :PepeGiveUp:
Want results from more Discord servers?
Add your server