0
KEYが間違っているか提供されていなくても、私たちのアプリはGoogleAPIClient
に接続できます。アプリが正常にGoogle Nearby APIに接続されているかどうかを確認するには?
<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();
}