tic*_*fab 11 android illegalargumentexception google-cloud-messaging google-play-services
我正在Android应用程序中设置Google Cloud Messaging.一开始,我初始化GoogleApiClient以检查Play服务是否可用:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
Run Code Online (Sandbox Code Playgroud)
试图运行它会产生IllegalArgumentException: must call addApi() to add at least one API,所以我还需要添加GCM Api,但说实话,我在文档中找不到它.就像是:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(gcm.API) <----- WHAT HERE?
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
Run Code Online (Sandbox Code Playgroud)
看起来还没有办法GoogleApiClient与Google Cloud Messaging结合使用.在那之前,我们需要使用这种GooglePlayServicesUtil方式.
| 归档时间: |
|
| 查看次数: |
1763 次 |
| 最近记录: |