0

I want to be able to disable/remove ads from my own apps when i download them from google play. Currently the only way i know is to first remove the adview from the xml then generate the apk then install on my devices. Then put it back then upload it to google play store.

Is there a way to do this (programmatically) or any other approach so that i don't have to keep commenting/uncommenting codes?

ads
  • 1,703
  • 2
  • 18
  • 35
  • With Admob you can use the device ID to disable ads on test devices, but you didn't mention what service. – Steve M May 27 '14 at 03:19
  • hi. can you give me more information on how to use the device ID? i'm thinking use the device id of my unit then on the onCreate method, i can check if unit's device id is equal to my device id then remove view? also, not sure what you meant by service. – ads May 27 '14 at 04:38

1 Answers1

0

If you're using Admob, you can simply add your device as a test device and this will be enough to prevent live ads being sent to your device. See the documentation.

Note, you will still have a test ad displayed on your device, if you want to remove it for aesthetic reasons, you will have to have the program determine the running device id, and not allow the adView to load an ad.

Get the device ID programmatically: With READ_PHONE_STATE permission:

Without READ_PHONE_STATE permission.

Community
  • 1
  • 1
Steve M
  • 9,296
  • 11
  • 49
  • 98
  • i will be accepting this as the answer to my question since i find it more applicable to my scenario. however, hichris123's solution is also good. – ads May 30 '14 at 00:54