@Chang so at first, does any of Gideros exported apps (not inside player, but reall apps) run on Android 4.2? They probably are, but still I thought I need to ask, since I think that Android 4.2 was released after latest version of Gideros, thus there might be something wrong.
If yes, then please try to run this app http://appcodingeasy.com/test/AdMob.apk It simply loads an ad from lua and does nothing more. Just to test if it's a problem with displaying ad or with some additional functionality.
If it all runs well, we'll try other functionalities as positioning etc, cause error will be somewhere there.
If this does not run, then you can test this project http://appcodingeasy.com/test/AdMob.zip which is a project of the app. And try posting any errors you may find while using it, or better post whole logcat to the pastebin and post a link here
Well I noticed that for the previous project the target was set to Android 4.1, now I've changed it to 4.2 (Had to remove Google Billing, cause it seems not to work with 4.2).
So did you previously, when you had random crashes, tried mine project or you did your own?
Ok, then problem might be in other actions, as setting positions, or providing ad types, or hiding/displaying add, etc. As I'm not a Java developer, there are a lot of ways I could have screwed it up.
Ah you where first. Okay, than I'm probably doing something wrong there. How bad is this positioning needed? I mean, maybe I can create something which simply positions alignment as top/bottom, left/right, center? Because if you position the ad that at least portion of it is outside the screen, it will crash the app. Since Gideros can use some internal scaling and logical dimensions, it might be pretty hard to properly position the app in pixels. So should I bother? Will it be needed?
@Chang, @ar2rsawseen: I came across this problem with my Mobclix plugin over the weekend.
It appears to happen when the app is trying to set the position of the ad on screen before it has been loaded. The easiest solution I found was to move the
//if we have no layout createif(layout ==null){
....
}
code into the onCreate function. That way the problem should never occur.
@Scouser you are using my AdMob plugin as a template to MobClix? /:)
And you haven't shared it? :-O
@Scouser that could be it, it worked on Androids 2.2 and 2.3 all the time and only sometimes on older Androids, thus probably it needs more time to load there.
@Scourser: could you please make it more detail about how to avoid app crash?
I had implemented Admob plugin successfully but sometime my app crash when load ads (2/8 times), I think your solution probably right. Random crash is a very bad experience for player.
@ar2rsawseen: what happen if I do not use admob.setPosition? Because it's ok for a top left position in my games so maybe I don't need to use setPosition function. Thank you
What does it return if there is no wifi/data connection available?
What does it return if there is some form of adblock software running?
URLLoader is an asynchronous process, it has three callbacks that you can listen to with eventListeners.
Event.COMPLETE -> When all the data is downloaded Event.PROGRESS -> Everytime a new packet is received towrads the downloading data Event.ERROR -> When an error occurs, like when it cannot be reached or accessed.
@ar2rsawseen, I have used your plugin in my app. It loads and shows well. However when I close the application. In the next execution of the app, the ad never loads. Thank you.
@ar2rsawseen Yes it happens after the program finishes with the application.exit() function. In the next execution it doesnt load the ad. However when I clean the cash and other stuff of the program in Android settings->manage apps, it loads.
In both times, I have an internet connection. Thank you.
@homeless I will try to experiment more, but I have not experienced that before. Does it happens only on your device, do you have other devices to try out?
Yes I tried on some other devices as well. Anyway I think it is about setPosition() fuction. Are you going to fix that or leave it to somebodyelse? ) thanks.
@homeless yes I think I already wrote the Java part and started working on C (JNI to Lua) part, but I catched some kind of cold and was ill couple of last days, now trying to get things together and probably soon will continue on this one!
Comments
@Chang awesome, I will prepare a test app and test project for you to try
They probably are, but still I thought I need to ask, since I think that Android 4.2 was released after latest version of Gideros, thus there might be something wrong.
If yes, then please try to run this app http://appcodingeasy.com/test/AdMob.apk
It simply loads an ad from lua and does nothing more. Just to test if it's a problem with displaying ad or with some additional functionality.
If it all runs well, we'll try other functionalities as positioning etc, cause error will be somewhere there.
If this does not run, then you can test this project http://appcodingeasy.com/test/AdMob.zip which is a project of the app. And try posting any errors you may find while using it, or better post whole logcat to the pastebin and post a link here
I've tested your AdMob.apk on 4.2.1 device, so far so good, no problem and ad is displaying correct.
Now I'm thinking what might be causing the random crash previously? Without AdMob it never crash, with AdMob it crash at 50% chance. :-$
I'm using this line to setPosition of the ad:
I'll update again after I do more tests with setPosition.
UPDATE:
Using admob.setPosition(0, 0) also crashes the app at most of the time.
Well I noticed that for the previous project the target was set to Android 4.1, now I've changed it to 4.2 (Had to remove Google Billing, cause it seems not to work with 4.2).
So did you previously, when you had random crashes, tried mine project or you did your own?
Ok, then problem might be in other actions, as setting positions, or providing ad types, or hiding/displaying add, etc. As I'm not a Java developer, there are a lot of ways I could have screwed it up.
So here is an app with changed position of AdMob
http://appcodingeasy.com/test/AdMobPos.apk
Okay, than I'm probably doing something wrong there. How bad is this positioning needed? I mean, maybe I can create something which simply positions alignment as top/bottom, left/right, center?
Because if you position the ad that at least portion of it is outside the screen, it will crash the app. Since Gideros can use some internal scaling and logical dimensions, it might be pretty hard to properly position the app in pixels.
So should I bother? Will it be needed?
Likes: thanhquan1512
I've tested your changed position AdMob, and it runs 7/10. But the error from LogCat is different:
As long as setVisible and removeAd works well, the position doesn't really matter that much :-). (Tested and have no problem so far).
@Chang: I tried again with my own project and it works on my emulator, haven't tried on real device yet.
Ultimate Games on Appstore
Ultimate Games on Google Play
Ok then I just need to figure out how to deal with alignments in Android Views.
It appears to happen when the app is trying to set the position of the ad on screen before it has been loaded. The easiest solution I found was to move the
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
And you haven't shared it? :-O
@Scouser that could be it, it worked on Androids 2.2 and 2.3 all the time and only sometimes on older Androids, thus probably it needs more time to load there.
There is also another plugin to detect whether there is a WIFI or data connection which is currently in test
Rest assured, these plugins will be shared (along with examples of use)
I found this problem happened when I forced a user to turn on their data/wifi connection before they could play (so my ads and flurry would work)
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
I had implemented Admob plugin successfully but sometime my app crash when load ads (2/8 times), I think your solution probably right. Random crash is a very bad experience for player.
@ar2rsawseen: what happen if I do not use admob.setPosition? Because it's ok for a top left position in my games so maybe I don't need to use setPosition function. Thank you
Ultimate Games on Appstore
Ultimate Games on Google Play
Likes: thanhquan1512
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
@Scouser can't you simply use UrlLoader or LuaSockets to check for Internet connection?
Likes: thanhquan1512
Ultimate Games on Appstore
Ultimate Games on Google Play
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Event.COMPLETE -> When all the data is downloaded
Event.PROGRESS -> Everytime a new packet is received towrads the downloading data
Event.ERROR -> When an error occurs, like when it cannot be reached or accessed.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Thank you.
Does it happens after it completely exits app or only while app is in background?
What happens if you uninstall app and install it back again?
Are you sure that you still have an active Internet connection after exiting and launching app again?
In both times, I have an internet connection.
Thank you.
Does it happens only on your device, do you have other devices to try out?
thanks.
Thank!