Android Ads using AE

Previous topic - Next topic

MrPlow

Hi Guys

Just wondering what is required for Intersitial ads?

The info is very limited for implementing...(or I haven't found it :-)  )

Do I need to setup an api id for this?
Am I only allowed to publish my own house ads?



[ Okay : Just found it in help file - I think I am good but still looking to find out if only house ads are allowed ]
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

AE Sample app is the androidmanifest.xml correct - there are two <activity sections and one is not closed with </activity>??
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

im guess that info got wiped around the forum crash......

its pretty much more simple than inapp purchase.

+ login to your admob account:
https://apps.admob.com/#home

+ Create a new app
- search for your app (or add manually)
- add a new Interstiitial add (only that is supported by AE)

+ you see a ad-unit id, which can been something like this:
  ca-app-pub-1234567892401330/1234567890

that id need to been set in the file distribute\Android\res\values.strings.xml with the line (that line might got removed in the recent sample for some reasons):

<string name="Admob_ca_app_pub">ca-app-pub-ca-app-pub-1234567892401330/1234567890</string>

Then the ads should works.

now its should works. Actuelly the activity is closed. That due its just a one line tag and is directly closed by a />.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Great stuff - thanks!

If only I can get my compiling to work now... :(

Build errrors saying missing build.xml file?! on my main laptop.

(I did a trial compile on another Laptop, but the app wont install on my nexus?! but all seemed to go fine)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Hi

Will testing an apk work and show ads or does the apk need to uploaded to google play to show the ads?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

you dont need to upload to google play first. But be aware dont click to much, because there is no testing ads, due the strange way google have implemented that feature (unlike Amazon).

But there is some loading for each ads, and sometimes that might fails loading. Howover the value about it should returns when trying to show it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

#6
Sorry, didn't quite follow that...?!

I just have a blank screen and then my app goes to main menu as normal - no ads showing.

Is that normal?

Also the AndroidExtras sample looks like it should show and intersitial ad but I see nothing (same as for my own app)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

My admob console is showing 13 requests but 0 impressions  (must be from my testing)

If I publish will regular users see my ads?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#8
yes, property you >might< need to upload a alpha version in google play as well. Im see im actuelly did that for the Android Sample, before the ads did working. Its mightbeen its was the same issue.? The status here is in "Ready to Publish" and the apk is a older version. But you dont need to publish or upload each time.

Also make sure the package you using is the same you added in admob (com.company.title).

Im not sure im updated the code, but here is the version im uses for all my games (which also checks if the ads fails):

Code (glbasic) Select

GLOBAL adService AS Admob
GLOBAL COULDSHOWADS=0
GLOBAL COULDSHOWADSWARNING=0

TYPE Admob
state%=0
statuscode$=""
isadloading%=0
time=0

FUNCTION status$:
RETURN self.statuscode$
ENDFUNCTION

FUNCTION loadit%: ID$=""
IF self.statuscode$<>"" THEN RETURN FALSE
self.statuscode$="Waiting: Loading"
self.state=1
?IFDEF ANDROID
JavaCall$("admob:load")
?ENDIF
self.isadloading=1
self.time=GETTIMERALL()+250 // required to preent eventuelly crashes.
RETURN TRUE
ENDFUNCTION

FUNCTION paintit:
PaintGame()
ENDFUNCTION

FUNCTION reset%:
IF self.isadloading=1 THEN RETURN
IF self.statuscode$<>"" THEN RETURN 0
self.state=0
self.statuscode$=""
ENDFUNCTION

FUNCTION show%:
IF self.isadloading=1 THEN self.state=1

?IFDEF ANDROID
IF self.state=1
LOCAL t=GETTIMERALL()-self.time
IF t<0 AND t>-5000 THEN RETURN
self.time=GETTIMERALL()+500
LOCAL result=JavaCall$("admob:isloaded:3")
IF result=0 THEN RETURN 0
COULDSHOWADS=1
self.isadloading=0
IF result<1
self.state=-1
IF result=0 THEN self.state=0
IF result=-1 THEN self.statuscode$="Error: Internal"
IF result=-2 THEN self.statuscode$="Error: Invalid request"
IF result=-3 THEN self.statuscode$="Error: Network Error"
IF result=-4 THEN self.statuscode$="Error: No fill"
IF COULDSHOWADSWARNING=0
COULDSHOWADSWARNING=1
ELSE
COULDSHOWADS=0
ENDIF
self.isadloading=0
RETURN -1
ENDIF

IF result=1
COULDSHOWADSWARNING=0
result=0
JavaCall$("PauseState:0")
GOSUB GLB_ON_PAUSE
JavaCall$("admob:show")
REPEAT
SLEEP 200
result=JavaCall$("admob:isloaded:3")
IF result>2 THEN BREAK
SHOWSCREEN
UNTIL result>2
IF result=3 THEN self.statuscode$="Success: Closed"
IF result=4 THEN self.statuscode$="Success: Clicked"
result=1
SLEEP 100
GOSUB GLB_ON_RESUME
JavaCall$("PauseState:1")
SHOWSCREEN
JavaCall$("FullScreen:2")
self.isadloading=0
RETURN result
ENDIF
ENDIF
RETURN 0
?ENDIF
ENDFUNCTION
ENDTYPE


and show a ads like this (around all SHOWSCREEN):

Code (glbasic) Select

LOCAL succes=adService.show()
IF succes>0
adService.reset()
ENDIF


PS. btw im have not much time today and the follow days. So im cant look eventuelly issue in the sample project before later.

PPS. You can also checkout LOGCAT when sometimes fails.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

#9
Hi
I used the code from the help info and sample

Code (glbasic) Select
// ad showing
LOCAL result=adService.show()
IF result<>0
adService.reset()
ENDIF


I will try with your code and your intersitial code snippet
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Still no luck with the ads showing and the app is now live.

I used the return statements from GLB On Pause samples to make sure all was correct and did android.init() and define value.

I am also using USESCREEN -1 then Showscreen then adService.show()

Code (glbasic) Select
USESCREEN -1
STRETCHSPRITE 99, 0,0, ssx,ssy
SHOWSCREEN


IF showads = TRUE

// ad showing
LOCAL result=adService.show()
IF result>0
adService.reset()
ENDIF
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Did you load one beginning in your code? What did the logcat output?

You don't need to publish under testing, just its ready to publish.

Eventually you can give me a test project on pm for me to look on, If it's still bugs out.

Your app is pauses while ads is show, which is why its require to use the code, when it's picks up a ad.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi Spacefractal

My admob console shows that the requests are being made but out of hundreds of requests only 1 impression is recorded.

Is this typical or could it be a problem in my admob setup?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs