Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

android - Google Play Games achievement unlocked popup not showing

I'm unlocking achievement using this simple method from developers docs:

Games.Achievements.unlock(getApiClient(), "my_achievement_id");

Achievement unlocks, but no popup shows up. There is also no popup when logged in to Google Play Games - which is connected.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just add a view to the layouts you want to display achievements on like this:

<FrameLayout
        android:id="@+id/gps_popup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp" />

When you have your layout ready you neet to execute this inside your Activity or Fragment:

Games.setViewForPopups(getApiClient(), findViewById(R.id.gps_popup));

You have to be sure, that your GoogleApiClient is connected though, otherwise your app will crash.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...