0

I have a library project that I'm using as the engine for 2 separate apps. Can I keep all the AdMob stuff in the library or do I have to make separate ones for each app? Also, where's the best place to store the AdMob ID? Right now I have it in strings.xml but I don't know if it's something that needs to be kept private or not.

Thanks!

1 Answer 1

1

AdMob AdViews need to be added to a layout in each one of your apps. Unless your library constructs layouts, you'll probably need to have some AdMob code in each app. You'll probably want to keep all of the AdMob code in each app, unless there are common implmentations between the two apps, such as the same way of setting up an ad request, or the same AdListener implementation.

The publisher ID is not that private a number. It can be found in LogCat when your app requests ads.

Sign up to request clarification or add additional context in comments.

2 Comments

There is one activity in the library that will be used in each app that has AdMob in the layout. Based on what you are saying, does that mean I should leave it as is? And can I keep it registered as being on one app?
If your library constructs the activity, you should be fine leaving this content in the library. While you can use the same publisher ID for both apps, the recommendation is to use separate IDs for separate apps. If one of your apps breaks the Admob Terms of Use (ex: can't put ads in an app with mature content), and that pub ID gets shut down, you don't want it affecting your other app. Perhaps each app could pass in the pub ID as a string into your library, or some enum value and have your library keep a reference to all IDs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.