fw/applib: Provide sdk music volume and sound for iOS find phone app and others#1326
Open
asyba wants to merge 1 commit into
Open
fw/applib: Provide sdk music volume and sound for iOS find phone app and others#1326asyba wants to merge 1 commit into
asyba wants to merge 1 commit into
Conversation
… and others Signed-off-by: Federico Bechini <federico.bechini@gmail.com>
Member
|
I think this should wait until we have a better permission system: otherwise an app could play loud noises without my consent |
Contributor
Author
|
@jplexer like a system where people can allow/denied if the app/face can control volume, take screenshots, play sounds, turn off wifi, etc on the mobile connected? How long will it take to start that new system? In the next 6 months? sooner? |
Member
|
I cannot give you an estimate really, I think @sjp4 was primarily working on this |
Member
|
Hopefully in the next month or two |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I got tired of forgetting my iPhone in the garage and not being able to find it, so I did some tests to see how to run "Find My Phone" on iOS.
I know there's an app that allows you to do this on Android, but it's missing for iOS since it's more restrictive.
https://apps.repebble.com/find-my-phone_695da4c3fbfdde0009f99799
Research:
According to my research, on iOS we can use AudioServicesPlayAlertSound, AudioServicesPlaySystemSound, AudioServicesPlaySystemSoundWithCompletion, AVSpeechSynthesizer, and AVAudioPlayer.
But playing around with different options, not all of them work well for every test scenario. For example, if the volume is low/mute, it will only vibrate; if it's on silent (physical button), it will only vibrate. So, after experimenting, I concluded that the ones that will always play sound, regardless of whether it's on silent or in focus mode, are AVAudioPlayer and AVSpeechSynthesizer.
Implementations
With AVAudioPlayer, we have to use a custom MP3 ringtone. I uploaded a short 3-second example.
AVSpeechSynthesizer is useful, for example, for speaking a phrase or word aloud. I believe it's primarily used for accessibility, but it could also be useful for finding the phone or for other functionalities the community might come up with.
I set the sound to a 3-part loop. If we make it infinite, it will keep playing continuously, and if we lose connection/context with the watch, we can't stop it. The only option is to manually close the mobile app. We need to be careful about leaving it playing indefinitely.
I created a test watch app; here's the code: https://github.com/asyba/PlaySoundMobile obviously, it uses the modifications I made to the SDK in this PR.
The mobile PR iOS find phone mobileapp#199 primarily allows calling SMS/alarm sounds, a default ringtone, synthesized voice, and sounds using the system sound ID.
The FW allows to call those sound methods plus expose the volume and get level control, to also allow the watchapps to set the level to max for find my phone feature.