I have a method that is doing unlock achievement in ExampleA Activity. I call this method from ExampleB Activity. It is working correctly except unlock notification is showing when I open ExampleA. I want to show unlock notification in ExampleB.
ExampleA.java
...
public static void unlockTheAchievement(int achievementId, AppCompatActivity activity) {
if (isSignedIn()) {
Games.Achievements.unlock(mGoogleApiClient, activity.getString(achievementId));
}
}
ExampleB.java
ExampleA.unlockTheAchievement(R.string.achievement_level3, ExampleB.this);
Thank you.
Maybe there is a part of your code that is calling the unlockTheAchievement
in ExampleA activity. As stated here , you can use startActivityForResult
or you can pass the values from one activity to another using intents and do what is required. But it depends on what you intend to do in the method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.