Reputation: 1
I want to add Watch module to existing android project. this is the line in phone project androidmanifest:
<application
android:name="com.xxx.xx.core.xx"
android:icon="@drawable/launcher_icon"
android:label="@string/app_name">
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.xx.xx" />
</intent-filter>
</receiver>
....
This is the onPeerConnected method:
@Override
public void onPeerConnected(Node peer) {
super.onPeerConnected(peer);
Toast.makeText(this, "Peer Connected To Phone", Toast.LENGTH_LONG).show();
}
I introduced with a problem. Connection is done sometime. I sometimes see "Peer connected to phone" toast. However, when i deploy new versions to phone and watch, connection fails and i dont see toast message. Any ideas ?
Note: Both have the same package name in their own androidmanifest files
Upvotes: 0
Views: 87
Reputation: 42208
onPeerConnected
will only be called, if connection state changes. If your app gets reinstalled, then it just arrives in some state and since there is no change, it will not trigger the callback. You need to also explicitly check the connection state using NodeApi.getConnectedNodes
.
Upvotes: 1