Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rewarded admob banner #7

Merged
merged 3 commits into from
Apr 3, 2017
Merged

Added rewarded admob banner #7

merged 3 commits into from
Apr 3, 2017

Conversation

dtyugin
Copy link
Contributor

@dtyugin dtyugin commented Mar 28, 2017

Similar to interstitial but also contains time on the Ad, when time is out user can close the banner and get reward (is a value of float type, can be coins/starts/points in your game).
I didn't get any docs on google about reinitializing rewarded Ad on ios as it was mentioned regarding interstitial. So it could be needed or not I don't know, disabled for now (have no ability to check on ios)

@larpon
Copy link
Owner

larpon commented Mar 29, 2017

Wow - you are a busy bee! 🐝 😄

I'm a bit tied up on work today - but will review and merge ASAP. Thanks!

Copy link
Owner

@larpon larpon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - maybe try to workaround the string bug by copying the actual bytes to a member of the class - so you wont get hit by any char pointers getting deleted / garbage collected while you access them from Qt. Many if not all QString char (byte) array operations and stuff like c_str() doesn't take copies AFAIK

qDebug() << this << "::onPresentationStateChanged() loaded false";

// NOTE iOS necessities
/*#if defined(Q_OS_IOS)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this when time permits :)

//We could get reward type (which is identifier name in firebase console)
//but unfortunately any access of string object cause crash
//So just use amount only
//qDebug()<<this<<"award type empty:"<<reward.reward_type.empty();
Copy link
Owner

@larpon larpon Mar 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a thing with the convertion - or the char pointer in firebase getting deleted before you get a chance to store it/use it? I've had a lot of problems with this. Read on:

Have you tried copying the actual char byte array (from firebase) into a member of your class?

This is the reason I have stuff like these where I need to store a string (char*) read from or fed to firebase:

QString _adUnitId;
QByteArray __adUnitIdByteArray; // <- this should store a copy of the chars/bytes in the array from the string you want to store from Firebase - this is important because QString byte array functions delete the contents after the function return - so we need to store it permanently on the class

// Then copy contents from the byte array to the QString - and use the QString (_adUnitId in this case) in the rest of the code

You can see how I've worked around it if you follow these:
https://github.com/Larpon/QtFirebase/blob/master/src/qtfirebaseadmob.h#L112-L118
https://github.com/Larpon/QtFirebase/blob/master/src/qtfirebaseadmob.cpp#L543-L544

  • in my case I'm storing it for firebase to read - but principle might/should be the same for when reading from firebase

If it really is a bug in firebase - I've had luck reporting it here:
https://github.com/firebase/quickstart-cpp/issues?q=is%3Aopen+is%3Aissue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll take a look.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a side note:
If you feel like it there's a friendly slack community at http://slackin.qtmob.org

  • it's got a wide range of developers - started by devs for Qt on mobile platforms.

No obligations - just a friendly notice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out the root cause of the crash with accessing strings. It seems I made link to wrong version of stl in my project (c++ instead of gnustl). So now it works ok. I will send update soon.

Copy link
Owner

@larpon larpon Mar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greenfield932 (nice job finding the root cause) - hmm - it might not be necessary - you can change the libs there's linked against here.
I haven't tried any other configurations (because it has worked on my machines) - so it might be related?

You can choose from these:

./android/arm64-v8a/c++
./android/arm64-v8a/gnustl
./android/arm64-v8a/stlport
./android/armeabi/c++
./android/armeabi/gnustl
./android/armeabi/stlport
./android/armeabi-v7a/c++
./android/armeabi-v7a/gnustl
./android/armeabi-v7a-hard/c++
./android/armeabi-v7a-hard/gnustl
./android/armeabi-v7a-hard/stlport
./android/armeabi-v7a/stlport
./android/mips64/c++
./android/mips64/gnustl
./android/mips64/stlport
./android/mips/c++
./android/mips/gnustl
./android/mips/stlport
./android/x86_64/c++
./android/x86_64/gnustl
./android/x86_64/stlport
./android/x86/c++
./android/x86/gnustl
./android/x86/stlport

@dtyugin
Copy link
Contributor Author

dtyugin commented Apr 3, 2017

Updated admob rewarded banner stuff. Now it works with reward type as well. Update remote config string fetching, crash was caused by the same issue with stl linking.

@larpon larpon merged commit bbf089f into larpon:master Apr 3, 2017
@larpon
Copy link
Owner

larpon commented Apr 3, 2017

Killing two bugs with one stone - awesome! I'll merge them in now 😄

@dtyugin
Copy link
Contributor Author

dtyugin commented Apr 3, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants