For Android phones/tablets:
You need to access the target device (get it in your hand and unlock it with the password/passcode) and physically install iKeyMonitor on it.
You need physical access and the iCloud ID/Password of the target iPhone/iPad and iCloud backup is enabled.
But if you have access to the device and it can be jailbroken, you can enjoy more features like screenshot capturing, keylogging and more.
You need to access the target device to install the spy app. Administrator password may be required when you install it.