Achievements

Overview

OpenFeint Achievements allow you to provide incentive to your players for completing alternative goals. For example, in a Hockey game, you might have an achievement for making a hat trick or winning a fight without taking any hits. When designing achievements for your title, think about what alternative objectives a player could have that require skill or effort. Achievements in OpenFeint have the following features:

golden achievement trophy An achievement is initially locked but can be unlocked once by each player. Each achievement awards a player with a set number of Feint points. Each player has a Feint Score. Its the sum of all her unlocked achievements. A players Feint score is prominently displayed on her profile. You can optionally customize the icon, name, description and score for every achievement in your game. We also provide a default icon for your achievements. Customized icons should be of size 50 x 50 pixels. An achievement can be marked as secret. A secret achievements description and icon are hidden from a player until progress is made on unlocking it or it is unlocked. Each title can have up to 100 achievements worth up to 1000 Feint score. On iOS, achievements can be unlocked even when a player is offline.

How To Unlock an Achievement in an Android App

Import

  import com.openfeint.api.resource.Achievement;

  import android.widget.Toast; // Used for presenting diagnostic messages.

The following code will unlock the achievement specified by the achievement ID 531293. Please replace this value with an actual achievement ID associated with your product key. Please replace MyClass with the name of the class containing this code:

new Achievement("531293").unlock(new Achievement.UnlockCB () {

  @Override public void onSuccess() {

    MyClass.this.setResult(Activity.RESULT_OK);

    MyClass.this.finish();

  }
  @Override public void onFailure(String exceptionMessage) {

    Toast.makeText(MyClass.this,

    "Error (" + exceptionMessage + ") unlocking achievement.",

    Toast.LENGTH_SHORT).show();

    MyClass.this.setResult(Activity.RESULT_CANCELED);

    MyClass.this.finish();

  }

});

Use a copy of the sample app built with your product key to verify that the achievement unlock was successfully.

To partially unlock an achievement in your Android application: Call either:

Achievement.UpdateProgression
Achievements Policy

Developers cannot create applications designed solely for the purpose of generating achievement points. OpenFeint reserves the right to disable achievements for applications that fall under this category. For additional information or clarification please contact developer support.

How To Unlock an Achievement in an iPhone App

To unlock an achievement in an iPhone app using an OpenFeint 2.6 or older, use either of the following methods:
[[OFAchievement achievement: achievementId] unlock]; // must include OFAchievement.h
[OFAchievementService unlockAchievement: achievementId ]; // must include OFAchievementService.h
To Unlock an Achievement in an iPhone App using an OpenFeint 2.7 or newer SDK

OpenFeint 2.7 introduced the ability to partially unlock achievements with a percentage completion. Only when the percentage completion reaches 100% is the achievement is considered unlocked. The following example shows how to unlock an achievement completely in one step without showing a notification:

[[OFAchievement achievement: achievementId] updateProgressionComplete: 100.0f andShowNotification: NO];

Note: You may call this unlock function more than once. It will only have an affect the first time it is unlocked for a player.

Header Files
OFAchievementService.h
OFAchievement.h
Achievements Policy

Developers cannot create applications designed solely for the purpose of generating achievement points. OpenFeint reserves the right to disable achievements for applications that fall under this category. For additional information or clarification please contact developer support.