-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: android PhoneCallManager #19638
base: master
Are you sure you want to change the base?
Conversation
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19638/index.html |
The build 156963 found UI Test snapshots differences: Details
|
#pragma warning disable CS0618 // TelephonyManager is obsolete in API 31 | ||
#pragma warning disable CA1422 // Validate platform compatibility | ||
_telephonyManager.Listen(new CallStateListener(), PhoneStateListenerFlags.CallState); | ||
if (await Extensions.PermissionsHelper.CheckPermission(CancellationToken.None, Android.Manifest.Permission.ReadPhoneState) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should only need the TryGetPermission
call here. It will return true
if the permission has already been granted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add an exception if the permission isn't allowed? like this
uno/src/Uno.UWP/Media/SpeechRecognition/SpeechRecognizer.Android.cs
Lines 24 to 27 in f8382a2
if (!isPermissionGranted) | |
{ | |
throw new UnauthorizedAccessException("The RECORD_AUDIO permission is either not present in your Manifest or was not accepted prior to attempting a speech recognition."); | |
} |
a076b27
to
e9a2569
Compare
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19638/index.html |
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19638/index.html |
The build 157483 found UI Test snapshots differences: Details
|
GitHub Issue (If applicable): closes #19633
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Telephony.Listen is deprecated for API >= 31, it causes a SecurityException now.
What is the new behavior?
Now we use Telephony.Listen if API < 31 and Telephony.RegisterTelephonyCallback if API >= 31. We also check the READ_PHONE_STATE permission that's required for this new method.
PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information
Internal Issue (If applicable):