Unlock achievement in google play games silently, without showing notification

时光怂恿深爱的人放手 提交于 2019-12-07 04:10:00

问题


I'm using google play services, achievements in my android game (it's actually unity, but doesn't matter).

To unlock achievement I use plugin which calls unlock(GoogleApiClient apiClient, String id) method. When achievements are set as completed, google shows its own notification, like this:

.

I need to unlock achievement silently, without showing this notification. Is there anything to hide it?


回答1:


For anyone else who wants an answer for this:

When you build your GoogleApiClient using new GoogleApiClient.Builder(this) you are giving Game Services an activity with which it can show notifications. If you change the context you pass into the builder to be the application context, rather than an activity, you shouldn't get any notifications.




回答2:


You can unlock the achievement in IntentService. Then it doesn't have any visual context to show the notification in.



来源:https://stackoverflow.com/questions/22376439/unlock-achievement-in-google-play-games-silently-without-showing-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!