Giter VIP home page Giter VIP logo

qtadmob's People

Contributors

antonsimakov avatar ildar-gilmanov avatar larpon avatar oleg-derevenetz avatar yevgeniy-logachev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtadmob's Issues

Add a way to control or get the height of the statusbar on Android

Hi - thanks for making this project available

I'm having trouble compensating for the m_StatusBarHeight that is added to the AdBanner view.

I have a QML app that set the activity to fullscreen - but due to some Qt Android specific code the statusbar isn't hidden before Qt is finished loading all it's parts on Android. Somewhere in this process the m_StatusBarHeight is sat before the app goes into fullscreen or maybe subject to the issues some other Stackoverflow users also have with the "old" method. So the ad banner has a top padding although the statusbar is hidden.

It would be nice with a fix or a method to "counter-act" the default padding - may a public method implementing this answers current method or similar

EDIT:
2785561 seems to do the trick

App crashes on start (Android)

I've been trying to make it work for 3 days. Also, i try to make QtAdMobApp (WidgetApp). It doesn't work. Sometimes different problems while compiling appear. In the other situations, when apk is ready, it crashes on start. Help me please.

Use on qt desktop application

Hey,

This looks like a great project.

Is it possible to use AdMob in a desktop application (no android or ios) through this module?

Thx!

Add possibility to have more instances of AdView in QML

I can't find a way to instantiate more than one of each QML type:

AdMobBanner {
...
}

AdMobInterstitial {
...
}

Adding a second AdMobBanner with a seperate unitId results in this exception:

W/dalvikvm(19478): threadid=1: thread exiting with uncaught exception (group=0x41f062a0)
E/AndroidRuntime(19478): FATAL EXCEPTION: main
E/AndroidRuntime(19478): java.lang.IllegalStateException: The ad unit ID can only be set once on AdView.
E/AndroidRuntime(19478):    at com.google.android.gms.ads.internal.client.zzae.setAdUnitId(Unknown Source)
E/AndroidRuntime(19478):    at com.google.android.gms.ads.BaseAdView.setAdUnitId(Unknown Source)
E/AndroidRuntime(19478):    at com.google.android.gms.ads.AdView.setAdUnitId(Unknown Source)
E/AndroidRuntime(19478):    at org.dreamdev.QtAdMob.QtAdMobActivity$1.run(QtAdMobActivity.java:50)
E/AndroidRuntime(19478):    at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(19478):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(19478):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(19478):    at android.app.ActivityThread.main(ActivityThread.java:4867)
E/AndroidRuntime(19478):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(19478):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(19478):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
E/AndroidRuntime(19478):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
E/AndroidRuntime(19478):    at dalvik.system.NativeStart.main(Native Method)

Crash on Android during app shutdown

I had a crash while the app was shutting down in QtAdMobActivity on line 293

I suspect a simple if is not null check on m_AdBannerView is enough - problem is I haven't been able to reproduce the crash

Interstitial not showing without AdMobBanner (QML)

Hi there

I've been having a lot of troubles getting QtAdMob to work but after a while I got it to work.

It now seems like I need to have an empty AdMobBanner {} in my QML file because otherwise (for some reason) the AdMobInterstitial never shows. Is this intended behaviour? Do you have an idea where things could go wrong?

Kind regards
Wesley

Some suggestions

First of all, thank you for this library. It has been really helpful!

I do have a number of suggestions:

  1. From Google Mobile Ads SDK version 17.0.0 onwards, it is required to add the following to the AndroidManifest
<meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  1. The widthChanged/heightChanged signals of an AdMobBanner are not sent when a banner is loaded (=> I had to fetch the width/height in the onLoaded signal)

  2. The x,y QML properties of an AdMobBanner uses device dependent pixels while the rest of the QML application uses device independent pixels (especially when using QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling) )
    Hence in order to position the banner at the bottom I had to set

y = parent.height*Screen.devicePixelRatio - banner.height

which is slightly inconvenient. It would be useful if the QML-user could use device independent pixels for x and y (and also get device independent values for the banner width/height; these should be divided by Screen.devicePixelRatiobefore returning them to the user)

  1. And we can go even one step further: the x/y currently refer to the global coordinates. So if I want to position an AdMobBanner at the bottom of a QML Item that is not full screen, I first have to do something like var globalBottom = root.mapToGlobal(0, root.height).y. Again, it would be convenient if this could be handled by the library. By doing so, the user could use both device independent pixels and the local coordinates of the parent Item of the AdMobBanner

  2. Finally, I had to modify QtAdMobActivity.GetStatusBarHeight and let it return statusBarHeight, otherwise the AdMobBanner was hidden behind the status bar when positioning it at (0,0)

Banner Not Showing QML

I'm creating a banner:
`AdMobInterstitial
{
id: intertitial
visible: true

Component.onCompleted: {
    intertitial.unitId = "ca-app-pub-xxxxxxxxxxxxxxx/yyyyyyyyyy"
}

onClosed: {
    intertitial.unitId = "ca-app-pub-xxxxxxxxxxxxxxx/yyyyyyyyyy"
}
onLoaded: {
    console.log("loaded")
}

onLoading: {
    console.log("loading")
}

}`

This is app output:

D Mobile Client: qml: loading I hoiceofmajorit: The ClassLoaderContext is a special shared library. I hoiceofmajorit: The ClassLoaderContext is a special shared library. I DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21800 I DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21800 D DynamitePackage: Instantiated singleton DynamitePackage. D DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl D NetworkSecurityConfig: No Network Security Config specified, using platform default I Ads : Updating ad debug logging enablement. I Ads : Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("2CEA88BC3475902B17D97EF1A9FE33F4") to get test ads on this device. W hoiceofmajorit: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection) I hoiceofmajorit: The ClassLoaderContext is a special shared library. I DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21800 I DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21800 I AudioManager: In isSpeakerphoneOn(), calling application: org.comp.choiceofmajority D AudioManager: getStreamVolume isRestricted mode = 0 D AudioManager: getStreamVolume isRestricted mode = 0 I WebViewFactory: Loading com.android.chrome version 80.0.3987.99 (code 398709932) I cr_LibraryLoader: Loaded native library version number "80.0.3987.99" W Ads : Update ad debug logging enablement as false W hoiceofmajorit: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (light greylist, reflection) D EgretLoader: EgretLoader(Context context) D EgretLoader: The context is not activity W hoiceofmajorit: Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (light greylist, reflection) W cr_media: Requires BLUETOOTH permission W VideoCapabilities: Unsupported mime video/divx W VideoCapabilities: Unsupported mime video/divx311 W VideoCapabilities: Unsupported mime video/divx4 W VideoCapabilities: Unrecognized profile 4 for video/hevc W VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2 W VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es W Utils : could not parse long range '175-174' I Ads : Ad failed to load : 0 I hoiceofmajorit: ProcessProfilingInfo new_methods=952 is saved saved_to_disk=1 resolve_classes_delay=8000 W ConnectionTracker: Exception thrown while unbinding W ConnectionTracker: java.lang.IllegalArgumentException: Service not registered: lt@2d8d000 W ConnectionTracker: at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1570) W ConnectionTracker: at android.app.ContextImpl.unbindService(ContextImpl.java:1702) W ConnectionTracker: at android.content.ContextWrapper.unbindService(ContextWrapper.java:727) W ConnectionTracker: at cg.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):1) W ConnectionTracker: at cg.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):6) W ConnectionTracker: at lu.A(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):10) W ConnectionTracker: at lf.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3) W ConnectionTracker: at dz.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3) W ConnectionTracker: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) W ConnectionTracker: at java.util.concurrent.FutureTask.run(FutureTask.java:266) W ConnectionTracker: at ja.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):6) W QtThread: type=1400 audit(0.0:3345): avc: denied { ioctl } for path="socket:[640053]" dev="sockfs" ino=640053 ioctlcmd=8b07 scontext=u:r:untrusted_app:s0:c184,c257,c512,c768 tcontext=u:r:untrusted_app:s0:c184,c257,c512,c768 tclass=netlink_route_socket permissive=0 W QtThread: type=1400 audit(0.0:3348): avc: denied { ioctl } for path="socket:[640053]" dev="sockfs" ino=640053 ioctlcmd=8b07 scontext=u:r:untrusted_app:s0:c184,c257,c512,c768 tcontext=u:r:untrusted_app:s0:c184,c257,c512,c768 tclass=netlink_route_socket permissive=0

Banner not showing. Should I upload a banner before showing? If yes, how? If not, why doesn't it showing?

Can't show banner

Hello,

App runs without the banner. I'm compiling on Linux for Android. I'm trying to get the banner to show.

Do I have to change the addTestDevice value? If so, with what? Sorry for my ignorance.

Banner Not Showing

Hi again,

Now my apps runs smoothly except that the banner is not showing in debug mode. Is it normal?

App crashes instantly

I've been trying to include this lib in my project for several days now and I can't get it to work.
I already tried using QtAdMobApp and I have same issue.
When I start application it closes immediately with an error, stack trace is:

E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.dreamdev.QtAdMob, PID: 7617
E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.dreamdev.QtAdMob/org.dreamdev.QtAdMob.QtAdMobActivity}: java.lang.ClassNotFoundException: Didn't find class "org.dreamdev.QtAdMob.QtAdMobActivity" on path: DexPathList[[zip file "/data/app/org.dreamdev.QtAdMob-1/base.apk"],nativeLibraryDirectories=[/data/app/org.dreamdev.QtAdMob-1/lib/arm, /data/app/org.dreamdev.QtAdMob-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2488)
E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665)
E AndroidRuntime: 	at android.app.ActivityThread.-wrap11(ActivityThread.java)
E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)
E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:111)
E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:207)
E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5765)
E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.dreamdev.QtAdMob.QtAdMobActivity" on path: DexPathList[[zip file "/data/app/org.dreamdev.QtAdMob-1/base.apk"],nativeLibraryDirectories=[/data/app/org.dreamdev.QtAdMob-1/lib/arm, /data/app/org.dreamdev.QtAdMob-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
E AndroidRuntime: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E AndroidRuntime: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E AndroidRuntime: 	at android.app.Instrumentation.newActivity(Instrumentation.java:1072)
E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2478)
E AndroidRuntime: 	... 9 more
E AndroidRuntime: 	Suppressed: java.lang.ClassNotFoundException: org.dreamdev.QtAdMob.QtAdMobActivity
E AndroidRuntime: 		at java.lang.Class.classForName(Native Method)
E AndroidRuntime: 		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E AndroidRuntime: 		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E AndroidRuntime: 		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E AndroidRuntime: 		... 12 more
E AndroidRuntime: 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

Please help.

Unable to run Sample App

When trying Admob's sample app on Qt 5.9.3 I get this error from main.cpp:

QtAdMob/QtAdMobInterstitialAndroid.cpp:145:50: warning: unused parameter 'isVisible' [-Wunused-parameter]
 void QtAdMobInterstitialAndroid::setVisible(bool isVisible)

Different sizeof(QtAdMobBannerIos) in C++ and ObjC code may cause memory issues

This line:

__unsafe_unretained QtAdMobBannerDelegate* m_AdMob;

may cause various memory-related issues because sizeof(QtAdMobBannerIos) will be different in C++ and ObjC code. For example, when you create QtAdMobBannerIos instance like this:

return new QtAdMobBannerIos();

and then call this inline function from C++ code here:

m_Instance = CreateQtAdMobBanner();

insufficient memory amount will be allocated to hold the whole QtAdMobBannerIos object in its ObjC "version". You can fix this as follows, for example:

#if defined(__OBJC__)
    __unsafe_unretained QtAdMobBannerDelegate* m_AdMob;
#else
    void* m_AdMob;
#endif

This fix assumes that sizeof(void*) is equal to sizeof(class*), which, strictly speaking, is implementation-defined, but that's OK for all platforms that iOS is currently targeting.

error while executing

Hi,

I have this error while trying to compile the project.
main.obj:-1: error: LNK2019: unresolved external symbol "public: static void __cdecl QmlAdMobBanner::DeclareQML(void)" (?DeclareQML@QmlAdMobBanner@@SAXXZ) referenced in function main

What did I miss?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.