我们的应用程序可以连接到GoogleAPIClient,即使密钥错误或未提供。
<meta-data
android:name="com.google.android.nearby.messages.API_KEY"
android:value="ourapikey" />MainActivity.java
public class MainActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Nearby.MESSAGES_API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.enableAutoManage(this, this) //enable auto manage
.build();
@Override
public void onConnected(@Nullable Bundle bundle) {
//THIS method is called -> we assume the GoogleApiClient therefore is successfully connected
backgroundSubscribe();
}发布于 2017-07-06 16:23:03
如果您尝试发布或订阅,则会发生失败。连接GoogleApiClient不会导致调用我们的服务器,所以没有使用密钥。
https://stackoverflow.com/questions/42943601
复制相似问题