Exemple #1
0
        public void OnConnected(Bundle connectionHint)
        {
            Task.Run(async() =>
            {
                await WearableClass.CapabilityApi.AddCapabilityListenerAsync(
                    mGoogleApiClient,
                    this,
                    WearableHelper.CAPABILITY_PHONE_APP);
                await WearableClass.DataApi.AddListenerAsync(mGoogleApiClient, this);
                await WearableClass.MessageApi.AddListenerAsync(mGoogleApiClient, this);

                mPhoneNodeWithApp = await CheckIfPhoneHasApp();

                if (mPhoneNodeWithApp == null)
                {
                    mConnectionStatus = WearConnectionStatus.AppNotInstalled;
                }
                else
                {
                    mConnectionStatus = WearConnectionStatus.Connected;
                }

                LocalBroadcastManager.GetInstance(this)
                .SendBroadcast(new Intent(ACTION_UPDATECONNECTIONSTATUS)
                               .PutExtra(EXTRA_CONNECTIONSTATUS, (int)mConnectionStatus));

                Loaded = true;
            });
        }
Exemple #2
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            Logger.WriteLine(LoggerLevel.Error, "SimpleWeather: {0}: onConnectionFailed(): " + result, TAG);

            mConnectionStatus = WearConnectionStatus.Disconnected;

            LocalBroadcastManager.GetInstance(this)
            .SendBroadcast(new Intent(ACTION_UPDATECONNECTIONSTATUS)
                           .PutExtra(EXTRA_CONNECTIONSTATUS, (int)mConnectionStatus));
        }
Exemple #3
0
        public override void OnCapabilityChanged(ICapabilityInfo capabilityInfo)
        {
            base.OnCapabilityChanged(capabilityInfo);

            mPhoneNodeWithApp = PickBestNodeId(capabilityInfo.Nodes);

            if (mPhoneNodeWithApp == null)
            {
                mConnectionStatus = WearConnectionStatus.AppNotInstalled;
            }
            else
            {
                mConnectionStatus = WearConnectionStatus.Connected;
            }

            LocalBroadcastManager.GetInstance(this)
            .SendBroadcast(new Intent(ACTION_UPDATECONNECTIONSTATUS)
                           .PutExtra(EXTRA_CONNECTIONSTATUS, (int)mConnectionStatus));
        }