Has anyone integrated AppBrain advertising into their LWP?

Discussion in 'Advertising Discussion' started by Alan, Aug 29, 2014.

  1. Alan New Guy

    Member Since:
    Aug 24, 2014
    Message Count:
    4
    Likes Received:
    3
    Trophy Points:
    0
    Help! I'm setting up AppBrain for my advertising and I'm getting hung up on some basic stuff at this point. (their instructions aren't geared towards a newbie like me, and I can't find any tutorials through Google searches). My options are (1) ask for help or (2) give up and use RevMob or AdMob, because basic instructions for those networks seem to exist everywhere...so I'm asking for help first.

    Here's the current problem--using the code provided by AppBrain to initialize the sdk, I'm getting errors in LiveWallpaperSettings.java and Splash.java, and the errors are the same in each:

    AppBrain's code:

    import com.appbrain.AppBrain;

    public class ExampleActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppBrain.init(this);
    }

    I get this error at "public class ExampleActivity extends Activity":

    Multiple markers at this line
    - Activity cannot be resolved to a type
    - The public type ExampleActivity must be defined in its
    own file
    - The type ExampleActivity is already defined

    I think "ExampleActivity" is causing the error, but not sure how to fix it. Anybody have ideas? Thanks!
  2. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    167
    Trophy Points:
    500
    Drop that line. You already have the Settings activity.
    You really just need to put AppBrain.init(this) into your onCreate().
  3. Alan New Guy

    Member Since:
    Aug 24, 2014
    Message Count:
    4
    Likes Received:
    3
    Trophy Points:
    0
    Vas, thanks for the quick response and the insight, looks like it fixed my issue here. :)

    Gotta say, you've done a great job with LWC, very impressive!!! I've been writing up a cheat sheet of code tweaks I've found through the forum and Google searches, hopefully I can post it to the forum tutorials soon as a one-stop-shop for fine-tuning in Eclipse. (background chooser, splash screen, advertising, Android versioning, etc)
    Vas likes this.
  4. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    167
    Trophy Points:
    500
    That's a great idea. Hope to see it soon :)
  5. Alan New Guy

    Member Since:
    Aug 24, 2014
    Message Count:
    4
    Likes Received:
    3
    Trophy Points:
    0
    Thanks, I'm about finished with it! Banners are working on splash activity and lwp_settings.xml, interstitial when opening settings. Just using AppBrain for now for simplicity, I'll add more variety down the road. My only sticking point now is a "More Free Apps" button in lwp_settings.xml, it's probably (definitely) a newbie thing, any suggestions? Do I just need to make a second AdPreference activity and ad layout xml? Thanks again!

    Here's what I have now as a placeholder in lwp_settings.xml:

    <Preference
    android:title="More Free Apps"
    android:key="appbrain_offerwall" />

    And here's the code AppBrain provides, with little (no) instruction on what else is needed to make it work:
    A similar method is available for opening the offerwall from a menu item:
    @Overridepublicboolean onCreateOptionsMenu(Menu menu){
    AdService ads =AppBrain.getAds();
    MenuItem item = menu.add(ads.getOfferWallButtonLabel(this))
    ads.setOfferWallMenuItemClickListener(this, item);
    returnsuper.onCreateOptionsMenu(menu);}
    Lukanio likes this.
  6. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    167
    Trophy Points:
    500
    I've looked over the instructions at the AppBrain site. From what I understand you are trying to bypass the interstitial that shows the offerwall to directly show the offerwall. The methods to accomplish this seem to be meant for a View based activity. The PreferenceActivity is not set up to use Views, as it uses Preferences. You can simply attach an onPreferenceClickListener() and call showOfferWall().

    Code (java):
            AppBrain.init(this);
            final AdService ads = AppBrain.getAds();
            Preference pref = findPreference("appbrain_offerwall");
            pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
             
                public boolean onPreferenceClick(Preference preference) {
                    ads.showOfferWall(LiveWallpaperSettings.this);
                    return false;
                }
            });
    However, AppBrain says that you need approval from them to either show offerwall directly or to use showOfferWall() method. Since the other implementations for Views essentially do the same thing (show offerwall directly), it seems a little ambiguous what you need approval for. I would seek clarification if I were you.
    To use the View implementation, you would need to overhaul your settings class, which I suspect is not something you want to do.

Share This Page