react-native-admob icon indicating copy to clipboard operation
react-native-admob copied to clipboard

Package does not work with react native 38

Open bendellarocco opened this issue 9 years ago • 11 comments

I have used this package since react native 20 or so. I recently went from react native 37 to 38 and ads are no longer served. I downgraded back to 37 and this issue was resolved.

bendellarocco avatar Dec 07 '16 22:12 bendellarocco

still im tried for android first time and its not worked.

emrecanozkok avatar Dec 10 '16 22:12 emrecanozkok

Worked for me with banners (RN 0.39, Android 6.0.1, on device). I did modify MainActivity to initialize the SDK:

import com.google.android.gms.ads.MobileAds;

public class MainActivity extends ReactActivity {

	...
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MobileAds.initialize(getApplicationContext(), "ca-app-pub-your-app-id");
	}  	
}

mp31415 avatar Dec 11 '16 02:12 mp31415

i have just tried RN 0.30 0.35 and 0.39 . but after added the package (Example android code used) my app closed unexpectedly... is there someone recently used package?

fahr23 avatar Dec 11 '16 18:12 fahr23

interstial ads working but banner not work.i will try @mp31415 idea

emrecanozkok avatar Dec 11 '16 18:12 emrecanozkok

i tried @mp31415 idea but i couldn't succeeded.. i will try only interstitial to see the result. thx...

fahr23 avatar Dec 11 '16 20:12 fahr23

IOS: Same here, not working with 0.38 or 0.39, only with 0.37. https://github.com/adeelraza/react-native-admob fork working, but pressing on the ad does nothing.

avishayil avatar Dec 14 '16 13:12 avishayil

got it working on Android using RN 0.39.2. I've modified MainApplication.java to add the required dependency:

import com.sbugert.rnadmob.RNAdMobPackage;

public class MainApplication extends Application implements ReactApplication {

    ...

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
	  new RNAdMobPackage()
      );
    }
}

It also works on iOS, but pressing the banner in simulator does nothing, not sure how it behaves on a device. I'm using 'EMULATOR' testDeviceID so this may be the case

Saurer avatar Dec 24 '16 19:12 Saurer

IOS: Same issue, on 0.37 the package works fine but when i switch to 0.39 it stop working.

screen shot 2017-01-05 at 3 26 05 pm

danyleo avatar Jan 05 '17 10:01 danyleo

@danyleo You can fork the library and mitigate breaking changes yourself, until author has the time to fix it. https://github.com/facebook/react-native/wiki/Breaking-Changes#namespace-all-header-imports-to-react-e1577d---javache

meznaric avatar Jan 08 '17 15:01 meznaric

@meznaric PR welcome 👍

dkolba avatar Feb 05 '17 20:02 dkolba

Closed by #95

alvaromb avatar Feb 24 '17 10:02 alvaromb