Android Question How detect if admob mediaview is a video or a image?

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.
i m using the @Erel code posted here.
https://www.b4x.com/android/forum/t...ds-advanced-with-mediaview.96873/#post-611090

this show a video OR a image....
how can i know if is a video or a image via code? i dont know if
getVideoController is the best way to detect this.

what i want to make is, detect if is a video, if is a video i will put this 100% on the nativeads size. if it is a image i need to get the size of the image and load a image with a correct size inside the nativead panel

another way to know if is a video or a image after loaded into the mediaview?

thx
 

Douglas Farias

Expert
Licensed User
Longtime User
hi. sorry i dont understand your english, i tryed use google tradutor but is incomprensive .
i have tryed this code, but when the mediaview is image i get a crash on this line
B4X:
Dim vid As JavaObject = NativeUnifiedAd.RunMethod("getVideoController", Null)

there is no way to get the video control if there is no video.

i think the best way is detect on media view, detect if is a image or a video, but i really dont know how to make this via java object
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
@asales

I updated the code in the post.
It checks if there is a video, if don't has a video, check for image.



the error is on this line
B4X:
Dim vid As JavaObject = NativeContentAdView.RunMethod("getVideoController", Null)
 
Last edited:
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
i m using native content, this code from erel.
https://www.b4x.com/android/forum/threads/any-news-about-native-ads-advanced.88100/#post-562893

i dont found any examples of NativeUnifiedAd on the forum. do you have a complete example to post here?

thx
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…