Note that there are some explanatory texts on larger screens.

plurals
  1. POHow Do I Block Adfree from blocking ads in my apps?
    text
    copied!<p>&nbsp; Adfree really upsets me as an Android Developer. I release apps in the market for FREE and all I ask is the user views ads while they use my app. I like to make a little money, and not take it from my users pockets. I'm assuming if you found this on Google than I am assuming this bothers you too.<br> I wrote this little bit of code with a buddy of mine to test if the user has Adfree installed on their phone. If it comes back positive (the app is installed), it informs the user that they have adfree installed on their phone, and in order to use the app, they must uninstall it. It then proceeds to close the app, so the user cannot use the app until Adfree is gone. <br> To begin with, put this in your OnCreate:</p> <pre><code>adfreetest(); </code></pre> <p>&nbsp; Now, put this code into your app somewhere (its modular, so it will work in any app) <br></p> <pre><code>private void adfreetest() { try{ ApplicationInfo info = getPackageManager() .getApplicationInfo("com.bigtincan.android.adfree", 0 ); //-- application exists AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("To Use this Application, You Must Uninstall Adfree.") .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub main.this.finish(); } }); AlertDialog alert = builder.create(); alert.show(); } catch( PackageManager.NameNotFoundException e ){ //-- application doesn't exist } } </code></pre> <p>&nbsp; Make sure to change main in <strong><em>main.this.finish();</em></strong> to the name of your activity.<br> If you find a better way to do this, please post!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload