mkorman9 / admob-openfl Goto Github PK
View Code? Open in Web Editor NEWGoogle AdMob extension for OpenFL
License: MIT License
Google AdMob extension for OpenFL
License: MIT License
Only in Ios the ads don't show up, if ad placement is at bottom.
Running AD.show() too many times (roughly 12) causes iPad to crash due to memory error.
Can be reproduced by simply calling AD.show() over and over, or through general app usage.
is there any example code on Interstitial?
i tried initInterstitial then showInterstitial but it quit my apps
thanks
On Android, when the interstitial appears the game pauses automatically, but on iOS the game keeps running. I'm not sure if this is a bug in the extension, or just the way AdMob works. It would be nice to at least have a way to know when the ad is closed.
Showing an interstitial causes the app to freeze. It will stay frozen indefinitely until the X button on the ad is clicked. If the X button is clicked, the app stays frozen, but then crashes soon after with a "Not responding" error.
The ad is being loaded in test mode.
I have done both of these ;
Copy android-template directory to your project
Add following code to your project.xml:
But It gives me this error ;
BUILD FAILED
C:\Users\-username-\AppData\Local\Android\sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
C:\Users\-username-\AppData\Local\Android\sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
And
error: cannot find symbol
[javac] private Sound _sound;
[javac] ^
[javac] symbol: class Sound
[javac] location: class GameActivity
Hello,
I have tried to include it in project.xml, but when I compile the game it says in flashdevelop:
"Error: Could not find haxelib "admob", does it need to be installed?"
How to solve this? I am using haxeflixel.
Edit Solved, forgot the first git command.
Thanks
I am trying to make it work on android.
I followed the instruction of the README file but I am having errors:
Here are the errors displayed on console when tested on android with -debug mode:
E/VoldConnector( 358): NDC Command {968 asec create smdl2tmp1 24 ext4 68a0d2b3a9e09a6453e1b84f2ecdc24d 10013 1} took too long (3958ms)
E/ProcessKiller( 91): Process android.process.acore (27662) has open file /mnt/asec/com.tbdlab.stayontrack-2/pkg.apk
E/ExternalAccountType(27642): Unsupported attribute readOnly
E/ExternalAccountType(27642): Unsupported attribute readOnly
E/Launcher( 9940): AppsCustomizePagedView, Widget ComponentInfo{com.google.android.googlequicksearchbox/com.google.android.apps.sidekick.widget.PredictiveCardsWidgetProvider} can not fit on this device (450, 375)
E/Launcher( 9940): AppsCustomizePagedView, Widget ComponentInfo{com.sand.airdroid/com.sand.airdroid.ui.widget.ConnectionWidget} can not fit on this device (444, 90)
E/ProcessKiller( 91): Process android.process.acore (27662) has open file /mnt/asec/com.tbdlab.stayontrack-2/pkg.apk
E/VoldConnector( 358): NDC Command {979 asec unmount com.tbdlab.stayontrack-2 force} took too long (3146ms)
E/jdwp (27930): jdwp::setsockopt(SO_SNDTIMEO)
E/jdwp (27930): jdwp::setsockopt(SO_RCVTIMEO)
E/jdwp (28054): jdwp::setsockopt(SO_SNDTIMEO)
E/jdwp (28054): jdwp::setsockopt(SO_RCVTIMEO)
E/dalvikvm(27752): Could not find class 'android.os.UserHandle', referenced from method com.google.android.gms.gcm.f.a
E/dalvikvm(28106): Could not find class 'android.os.UserManager', referenced from method eu.chainfire.supersu.User.a
E/dalvikvm(28069): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
E/dalvikvm(28069): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
E/GooglePlayServicesUtil(28069): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Any help would be highly appreciated
Hi there,
The extension works great on iOS. Now I try to publish it on Android. Since Openfl 1.4 has some Lib.hx issue (saw in another thread) and crashed my game every time the ad initialisation was called , I have to build it with Openfl 1.3. The game looks fine however no ad show up at all.
Btw, I tested it on a device with clean Android 2.3.5 without Google Play store. Most of Android devices here China don't have Google Play services installed. I think Admob should works on these devies without issues.
Here is part of log:
04-26 16:04:29.699: E/GooglePlayServicesUtil(6759): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-26 16:04:29.709: W/GooglePlayServicesUtil(6759): Google Play services is missing.
04-26 16:04:29.989: I/Ads(6759): Starting ad request.
04-26 16:04:30.489: W/Ads(6759): There was a problem getting an ad response. ErrorCode: 2
04-26 16:04:30.489: I/Ads(6759): Scheduling ad refresh 60000 milliseconds from now.
04-26 16:04:30.489: W/Ads(6759): Failed to load ad: 2
I compiled a simple openFl project but it crashed on a device, testing with logcat gave:
java.lang.NoSuchMethodError: no static method with name='initAd' signature='(Ljava/lang/String;IIZ)V' in class Lorg/haxe/lime/GameActivity;
I'm not sure if it matters but there is no "initAd" and other ads functions in Export\android\bin\src\org\haxe\lime\GameActivity.java
I've added android-template to my project source folder and code to my project.xml.
Hi, thanks for the great plugin. I want to ask if it's still based on the old NMEX extension or the Readme.md file is outdated. If it's still based on the old NMEX, can it work properly with the latest version of openfl?
Almost got banned from admob because i was playing my own add believing they were test ads.
"testMode" parameter in init functions has no effect.
I tried the latest admob-openfl for OpenFL 1.4 on Android. It seems that an error occurs with the next line of AD.hx.
_initAd_func = openfl.utils.JNI.createStaticMethod("org.haxe.lime.GameActivity", "initAd", "(Ljava/lang/String;IIIZ)V", true);
adb logcat
Lib.hx:300: Invalid Arg Count
What knows whether it is the cause?
It seems that I can't compile this for iOS anymore (but was working some time ago). Below is the error I get. Any ideas? Thanks.
Ld build/Release-iphoneos/LR.app/LR normal armv7
cd /Users/vasco/Desktop/LR/export/ios
export IPHONEOS_DEPLOYMENT_TARGET=5
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/vasco/Desktop/LR/export/ios/build/Release-iphoneos -L/Users/vasco/Desktop/LR/export/ios/LR/lib/armv7 -F/Users/vasco/Desktop/LR/export/ios/build/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks -filelist /Users/vasco/Desktop/LR/export/ios/build/LR.build/Release-iphoneos/LR.build/Objects-normal/armv7/LR.LinkFileList -dead_strip -lstd -lregexp -lzlib -llime -lcurl_ssl -lpng -ljpeg -lfreetype -logg -lvorbis -lApplicationMain -stdlib=libc++ -force_load /usr/lib/haxe/lib/admob/git/ndll/iPhone/libGoogleAdMobAds.a -miphoneos-version-min=5 -framework UIKit -framework OpenAL -framework OpenGLES -framework QuartzCore -framework CoreAudio -framework CoreGraphics -framework AudioToolbox -framework AVFoundation -framework Foundation -framework CoreMotion -framework MediaPlayer -framework CoreMedia -Xlinker -dependency_info -Xlinker /Users/vasco/Desktop/LR/export/ios/build/LR.build/Release-iphoneos/LR.build/Objects-normal/armv7/LR_dependency_info.dat -o /Users/vasco/Desktop/LR/export/ios/build/Release-iphoneos/LR.app/LR
Undefined symbols for architecture armv7:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
l001 in libGoogleAdMobAds.a(GADGestureUtil.o)
"_SCNetworkReachabilitySetCallback", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"OBJC_CLASS$_MFMessageComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SCNetworkReachabilityGetFlags", referenced from:
l001 in libGoogleAdMobAds.a(GADGestureUtil.o)
"OBJC_CLASS$_MFMailComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"OBJC_CLASS$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
"OBJC_CLASS$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADDevice.o)
objc-class-ref in libGoogleAdMobAds.a(GADGestureIdUtil.o)
"_SCNetworkReachabilityCreateWithName", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"OBJC_CLASS$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADDevice.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[GADNetworkChecker stopNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/Release-iphoneos/LR.app/LR normal armv7
(1 failure)
I used this new extension for Android. However, an error occurs and Android app crashes.
> adb logcat
java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Next, I added meta-data into android-template/AndroidManifest.xml.
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Then, the compile error occurred.
> lime test android
Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
Although it seems that it will solve if the directory of google-play-services_lib is imported, I do not understand the method.
When I rewrote meta-data below, the compile error stopped occurring. However, this method is not general-purpose.
<meta-data android:name="com.google.android.gms.version" android:value="4323000" />
Moreover, now, an advertisement is not displayed yet. The following errors occur. (This error has the possibility of the problem on the development machine side.)
> adb logcat
I/Ads ( 6297): Use AdRequest.Builder.addTestDevice("my deveice id") to get test ads on this device.
I/Ads ( 6297): Starting ad request.
V/WebViewChromium( 6297): Binding Chromium to the main looper Looper (main, tid 1) {41f18850}
I/chromium( 6297): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain( 6297): Initializing chromium process, renderers=0
W/chromium( 6297): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
E/GooglePlayServicesUtil( 6297): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
E/GooglePlayServicesUtil( 6297): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
E/GooglePlayServicesUtil( 6297): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
I/Ads ( 6297): No fill from ad server.
W/Ads ( 6297): Failed to load ad: 3
Three weeks ago, when I installed admob-openfl, it was fine, I could see ads in iOS simulator.
Today I have tried to compile and run it on Simulator and iPhone4. I don't see any ads and log terminal gives me this on iPhone:
<Google> To get test ads on this device, call: request.testDevices = @[ @"f608f152b8b49866843a7f14a6a6b72c" ];
and this on iOS simulator:
<Google> To get test ads on this device, call: request.testDevices = @[ GAD_SIMULATOR_ID ];
But I didn't choose to run it in test mode - I pass "false" as "test" argument in AD.init()
function. What could be wrong there?
Google requires to use Google Services instead of separate AdMob jar.
There are changes that should be made in code:
In GameActivity:
import
instead of com.google.ads.*
- com.google.android.gms.ads.*
AdRequest
using new AdRequest()
anymore. You need to use AdRequest.Builder
in order to create an instance.AdView
constructor does not expect all the arguments anymore.In AndroidManifest.xml
com.google.ads.AdActivity
should be replaced by com.google.android.gms.ads.AdActivity
And of cource, you can not include GoogleAdMobAdsSdk-6.4.1.jar
anymore, since it conflicts with Play Services jar
AdMob has been integrated into the newest version of Play Services. Google has provided a migration guide. Do you plan to update the extension so it uses Play Services? Or to provide a Play Services version as not all Android devices come with Play Services.
Thanks fro the great extension!
Can we somehow use interstitial ads?
Edited: make a note in README.md that PATH_TO_THE_HAXELIB_DIR should be replaced with real path which usually is /usr/lib/haxe/lib
When implementing your files now, I've been getting a compile error with this output:
-compile:
[javac] C:\Users\Matzerath\Desktop\OrangeHaxe\bin\android\bin\src\org\haxe\lime\GameActivity.java:172: cannot find symbol
[javac] symbol : variable packageName
[javac] location: class org.haxe.extension.Extension
[javac] Extension.packageName = getApplicationContext ().getPackageName ();
[javac] ^
[javac] C:\Users\Matzerath\Desktop\OrangeHaxe\bin\android\bin\src\org\haxe\lime\GameActivity.java:587: cannot find symbol
[javac] symbol : method onLowMemory()
[javac] location: class org.haxe.extension.Extension
[javac] extension.onLowMemory ();
[javac] ^
[javac] C:\Users\Matzerath\Desktop\OrangeHaxe\bin\android\bin\src\org\haxe\lime\GameActivity.java:598: cannot find symbol
[javac] symbol : method onNewIntent(android.content.Intent)
[javac] location: class org.haxe.extension.Extension
[javac] extension.onNewIntent (intent);
[javac] ^
[javac] C:\Users\Matzerath\Desktop\OrangeHaxe\bin\android\bin\src\org\haxe\lime\GameActivity.java:708: cannot find symbol
[javac] symbol : method onTrimMemory(int)
[javac] location: class org.haxe.extension.Extension
[javac] extension.onTrimMemory (level);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 4 errors
BUILD FAILED
C:\Development\sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
C:\Development\sdk\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.
I've tried various things to fix this (updated haxelib, changed SDK build, other madness) but get the same errors every time. Any thoughts? I did have this working previously, so maybe an openFL/Lime update is causing problems -- or I just screwed something up!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.