How to deactivate ads on Android?

svintaj

  • Posts: 353
I removed all the premissions in the android manifest file, but then it appears a red text message in my app saying: "You must have INTERNET and ACCESS_NETWORK_permissions to serve ads."?

Hmm ok, but I don't uses ads and I don't want to use them!? So how can I remove this message, without adding in the premissions that I like to remove?


Jon

  • *
  • Posts: 17524
If you've modified the manifest, then you're on the right track and don't need to do anything else. Maybe do a clean build of the project?

svintaj

  • Posts: 353
I have removed all the uses-permissions in the android manifest, so there must be something more to remove somewhere? I always get this red text in my apps, see attatched Picture:

rob1221

  • *
  • Posts: 9473
Try taking the ads extension folder out and see if that works.

svintaj

  • Posts: 353
If I hide the folder or remove Ads.hx, Stencyl compiles forever.

Is that text showingup produced by Stencyl or by the Android-operating system itself? I would of cource like to have an option to turn off ads in Stencyl.

Jon

  • *
  • Posts: 17524
It's definitely not produced by Stencyl.

GeorgeN

  • Posts: 856
You open the Ads.hx from Ads extension folder search for the initialize method and wrap all that code with an if(MyAssets.whirlID!=""). If inside Stencyl->Settings->Mobile the Adbmob Publisher Key is not filled up then the ads will not fire up.

The method should look like this:

Code: [Select]
public static function initialize(apiCode:String = "none", position:Int = 0):Void
{
if(MyAssets.whirlID!="")
{
#if(mobile && !android && !air)
if(!initialized)
{
set_event_handle(notifyListeners);
initialized = true;
}
#end

#if android
if(!initialized)
{
adwhirlCode = apiCode;

if(_init_func == null)
{
_init_func = JNI.createStaticMethod(ANDROID_CLASS, "initAdmob", "(Ljava/lang/String;I)V", true);
}

var args = new Array<Dynamic>();
args.push(adwhirlCode);
args.push(position);
_init_func(args);

initialized = true;
}
#end
}
}

svintaj

  • Posts: 353
Awesome GeorgeN, it works perfectly! :D Thanks!!

svintaj

  • Posts: 353
I recommend that this is changed permanent to be the standard code in Stencyl, since it helps without breaking anything!  8)

Now I have to add this change everytime I install a new Stencyl version...


GeorgeN

  • Posts: 856
I second that. If there is no Admob code filled up in Stencyl then the Admob activity has no sense to start. Also something like:   

::if (ANDROID_PURCHASES=="YES")::      
::end::

but for that admob ID field.

rob1221

  • *
  • Posts: 9473
Quote
I recommend that this is changed permanent to be the standard code in Stencyl, since it helps without breaking anything!

Done.  Download the new version and test to confirm.