Registers an app to receive notifications for achievements that are unlocked for its own title ID.
public:
static AchievementSource^ GetTitleIdFilteredSource()
Type: AchievementSource
Returns an AchievementSource object which can be used to assign an event handler for achievement unlocked events.
Namespace: Windows.Xbox.Achievements
Metadata: windows.winmd
using namespace Windows::Xbox::Achievements;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
class MyApp
{
void registerForAchievementUnlocked()
{
AchievementSource^ achievementSource = AchievementNotifier->GetFilteredSource();
achievementSource.AchievementUnlocked = ref new EventHandler<AchievementUnlockedEventArgs^>(
[&] (Object^, AchievementUnlockedEventArgs^ args)
{
Windows::Xbox::System::IUser^ unlockingUser = args->User;
String^ achievementId = args->AchievementId;
IVectorView<String^> rewards = args->InAppRewardValue;
// App can now update UI, trigger rewards, etc, based on achievement being unlocked
});
}
};