sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 531 forks source link

Rewarded interstitials? #22

Closed hasen6 closed 7 years ago

hasen6 commented 8 years ago

Just wondering if the 'rewarded interstitials' work? If so how would that be implemented - the same as a normal interstitial?

sbugert commented 8 years ago

The API for interstitials is not quite ready yet, so there is no way to add rewarded interstitials right now.

If you have any proposals for an API don't hesistate to jump in the discussion in #6.

hasen6 commented 8 years ago

Do you mean your plugin is not ready or the Google admob API itself is not ready? I realise its very new, it only came out about a month or so ago.

hasen6 commented 8 years ago

But ordinary interstitials are already working aren't they? They certainly seem to be for me at least.

sbugert commented 8 years ago

My plugin is not ready. Ordinary interstitials are already working on iOS and android but I want to extend the API soon.

hasen6 commented 8 years ago

I'd love to see this implemented. Is there any way I can help? I'm not the greatest programmer but I'd be willing to do any testing or whatever you need.

sbugert commented 8 years ago

As far as I can tell the only difference between normal and rewared interstitials are mediation networks and the class you call the method on?

I can imagine exposing a second module in the react-native-admob package which is almost the same as the ordinary interstitials. Shouldn't be too hard! The most difficult task with this react-native module is always finding a common API for iOS and Android.

But testing would be great :) I will get in touch with you when it's ready!

hasen6 commented 8 years ago

Ok hope you can figure it out. Really great that you provide this plugin. Certainly I can help with any testing or anything else you need me for.

sbugert commented 8 years ago

Update: I tried setting up a rewarded ad but seems like you need a mediation network even to really test it. Do you have access to one? With a google test id I only got a black ad with no video and whenever I add a test device id I get an error Request Error: No ad to show. So I guess it would work if I had setup a network supporting rewarded ads but I'm not sure. After I publish the new interstitial API I can commit the code to another branch for you to test!

hasen6 commented 8 years ago

You just need an account with some other Ad networks right? I haven't tried it yet but I remember I signed up to Chartboost and Flurry in the past.

hasen6 commented 8 years ago

Btw I got everything working on Android in the end. I don't know exactly what it was but my general unfamiliarity with Android in general probably had a lot to do with it.

hasen6 commented 8 years ago

Any progress with this...or is it a dead end?

sbugert commented 8 years ago

I'm quite busy these days but I think I can get something running at the end of the week or next week!

hasen6 commented 8 years ago

I guess you must be very busy hehe.

th0th commented 8 years ago

Implementation of rewarded interstitials would be awesome. Any news on this?

xing-zheng commented 8 years ago

Same to me!

th0th commented 8 years ago

@sbugert I am not familiar with java, so I can't help with the coding. But I can help documenting or testing. Also, I've enabled some mediation networks on my AdMob account, I can provide any details you need.

I am so desperate that I even tried taking a look at the code but, god, java code looks complicated to me. Is there any way I can help you so that we can get rewarded videos working? :)

hasen6 commented 8 years ago

Hey I'm the designated tester. That job is taken. :)

Btw its not Java, React is Javascript.

th0th commented 8 years ago

@hasen6 I just wanted to say I am ready to help when needed.

And by Java, I meant the native module for Android.

sbugert commented 8 years ago

I added a new branch (rewarded-video) to the repo with a first iOS version that is ready to be tested.

Of course, the more testers the better! (Btw react is javascript, the react-native bridge is platform-specific code so either Objective-C or Java which are the two languages most of the code of this project lives)

Instructions:
xing-zheng commented 8 years ago

@sbugert Great! I can't wait to test it! And I will post the feedback after test.

xing-zheng commented 8 years ago

Hi @sbugert , Did you forgot to check in a js file like "RNAdMobRewarded.js". I try to run the Example project follow your instructions, but It show me "Cannot read property 'setTestDeviceID' of undefined" while execute code:

AdMobRewarded.setTestDeviceID('EMULATOR').

after replace

import { AdMobRewarded } from 'react-native-admob';

with

const {RNAdMobRewarded:AdMobRewarded} = NativeModules;

It show me another error message: "AdMobRewarded.addEventListener is not a function"

xing-zheng commented 8 years ago

@sbugert Please review the commit @7ad8ea0165c1f03fbaad253a1535264c0390a03d

sbugert commented 8 years ago

You are right, I forgot the file!

Should be there now :)

xing-zheng commented 8 years ago

and the index.js ? :)

sbugert commented 8 years ago

Sorry! Should be there now :)

It's confusing because I do the development in another folder and have to copy files around.

xing-zheng commented 8 years ago

@sbugert Thank you for your rapid support

th0th commented 8 years ago

Did anybody manage to get a rewarded video displayed? I get "No ad to show" no matter I do.

sbugert commented 8 years ago

Have you correctly setup the mediation for the network you're using? And are rewarded ads enabled in said network?

On 02.08.2016, at 17:42, Gökhan Sarı notifications@github.com wrote:

Did anybody manage to get a rewarded video displayed? I get "No ad to show" no matter I do.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

th0th commented 8 years ago

@sbugert Actually, my application is for Android only. So all my accounts and such are configured that way.

I created a test iOS application and tried the account data of my android app on this new test application. I did my tests mainly on Chartboot and;

And when I built and run the application, I got the "no ad to show" error. At this point, I am sot sure if there is a problem with the library or Chartboost doesn't provide an ad since it expects my application to be from Android.

When I get some time, I'll try to create a new test app account for iOS on both AdMob and mediation network and try to test with the new data.

BTW, is there any progress about Android?

th0th commented 8 years ago

I am so excited, I got it working! I think the problem was about the iOS version I am testing. It was 7.0 (which is the XCode's default). I spent literally hours trying to integrate different SDKs from different mediation networks. A few minutes ago, a network's SDK I tried required a higher iOS version and I upgraded to 9.3 and video got loaded.

I can't wait to integrate it into my android application! @sbugert help me out :)

hasen6 commented 8 years ago

So it only works on iOS 9?

th0th commented 8 years ago

@hasen6 I don't think it is about react-native-admob. To use rewarded videos from mediation networks, you need to integrate those networks' SDKs. I think if there is a iOS version restriction, those SDKs are the cause.

hasen6 commented 8 years ago

So only certain networks could be incompatible.

th0th commented 8 years ago

I tried adding Android native module for rewarded ads trying to abide interstitial ads module. But I couldn't get it working, got this error:

can't create handler inside thread that has not called looper.prepare()

Can someone with Java skills have a look please? Code is here:

https://github.com/th0th/react-native-admob/blob/rewarded-ads/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedAdModule.java

sbugert commented 8 years ago

Great that it worked :) I will take a look at the android version on the weekend!

sbugert commented 8 years ago

So, I just merged @th0th's java code into the rewarded-video branch!

Would be good if we did some more testing. @xing-zheng, did you succeed in running the iOS version yet? Then we only need documentation and I will merge the branch and publish it to npm.

nschurmann commented 8 years ago

is this ready to go?? :)

alvaromb commented 7 years ago

Hi! @sbugert can I help you with anything? I would love to see this merged :)

resyncdigital commented 7 years ago

Would love to get this working, need any help?

alvaromb commented 7 years ago

I'll try to release this https://github.com/sbugert/react-native-admob/pull/80 today!

alvaromb commented 7 years ago

Just merged #94

alvaromb commented 7 years ago

Published https://github.com/sbugert/react-native-admob/releases/tag/v1.2.0

Please feel free to ping me if anything is wrong.