Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Watch app detect if a apple watch is paired with the phone

When the user opens the app on the phone is there a way to detect if the phone is paired/connected to a apple watch?

like image 726
user2636368 Avatar asked Apr 15 '15 21:04

user2636368


People also ask

How do you know if Apple Watch is paired with iPhone?

To see if your Apple Watch is connected to your iPhone, touch and hold the bottom of the watch screen, swipe up to open Control Center, then look for the Connected status icon .

Can iPhone detect Apple Watch?

You can locate your Apple Watch using the Find My iPhone feature. Use the Find My iPhone app on your iPhone or log into iCloud.com on a computer. If your Apple Watch is nearby, you can play a sound to help you find it.

How do I know if my watch and phone are connected?

Check your Apple Watch connection appears on your watch face. You can also check your connection in Control Center. When your Apple Watch connects again, the green iPhone icon appears. First, bring your Apple Watch and paired iPhone close together.


3 Answers

So on WatchOS 2 that is possible !

You have to do on iPhone side :

First :

import WatchConnectivity

Then :

   if WCSession.isSupported() { // check if the device support to handle an Apple Watch
        let session = WCSession.defaultSession()
        session.delegate = self
        session.activateSession() // activate the session

        if session.paired { // Check if the iPhone is paired with the Apple Watch
                // Do stuff
        }
    }

I hope It would help you :)

like image 92
BilalReffas Avatar answered Oct 25 '22 00:10

BilalReffas


There is no built-in method (at least in the WatchKit SDK) to determine if a Watch has been paired with an iPhone. A common strategy is to write a BOOL to a shared NSUserDefaults (using app groups) so that the iPhone knows that the Watch app has been run at least once. That's the technique I've used in my own app.

like image 35
Mike Swanson Avatar answered Oct 25 '22 00:10

Mike Swanson


If your code in your extension runs willActivate: on you controller then the Apple Watch is paired with the phone. Since you can't run any code on the actual Apple Watch there is no to know if the watch isn't paired with an iPhone.

like image 22
Stephen Johnson Avatar answered Oct 25 '22 00:10

Stephen Johnson