How to check if the biometric scanner is available and initialized in Xamarin android BiometricPrompt - xamarin.forms

Failed biometric(fingerprint) scan attempts are handled by OnAuthenticationFailed() callback of BiometricPrompt.AuthenticationCallback class.
The behavior I noticed is, it lets the user attempt 5 invalid fingerprint scans (each time the fail callback is invoked) and then the prompt dismisses. Within the next 30 secs, if we try to re-build a BiometricPrompt instance and try to authenticate, it does not show the prompt which I think is the default behavior of BiometricPrompt.
Is there anyway to check if the biometric scanner is available and initialised if the user attempts to re-invoke biometric prompt within the said 30secs?
How can I handle that use case?
xamarin android BiometricPrompt.AuthenticationCallback does not have an override method "onAuthenticationError" to handle error callbacks and thus I'm unable to handle error code "BIOMETRIC_ERROR_TIMEOUT".
If someone has a solution for this, please do let me know your resolution.

I believe that BiometricPrompt is not fully ported to Xamarin yet...
I'm still looking for a source that can double check this info for me, but I haven't found it either.

Related

ProgressNotification callback not triggered without an initial download in Realm 10

We are using MongoDB Realm in our app.
The first time the user is connected to the app, the ProgressNotifcation callback is triggered correctly, and it will work and trigger whenever a new download is coming.
Even if no download is pending, the ProgressNotification callback will be triggered (the Progress object pass in the callback will contain values from the last download) at least once(when creating it). I supposed this is due to the fact that we are downloading the first data set of the user.
But after killing the app and launching it again, the ProgressNotification callback is not triggered anymore until new data are received by the app. And from this point, the callback will be called every time we need it.
It seems that now, the framework needs a first download since the app is launch to make ProgressNotification callback to be triggered every time we need it.
This was working in the previous version of Realm (5.X.X). We just finished the migration to Realm 10 and discover this issue.
I am a bit stuck here, do not know if this is an intended change or a bug on my part. But I am pretty sure this was working in the previous version of the SDK.
Can anyone help me with this? Thanks
Note: this is no more working in both mode : .forCurrentlyOutstandingWork and .reportIndefinitely
Example
self.token = syncSession.addProgressNotification(for: .download, mode: .forCurrentlyOutstandingWork) { progress in
.......Some code........ <- this part of the code is not triggered anymore
}
EDIT - 21/12/2020
For clarification, the token returned contains a value and the .invalidate is not being called.
There is no error in the session and any new download is triggering the callback. After an initial download, everything works as expected. This means that when I add a progressNotifcation later on, the callback is triggered immediately with the progress of the previous download. But if there is not an initial download, the callback is never called.
For the scope, this method is actually in the custom publisher that I created and it is not deallocated.
Realm 10.5.0
iOS 14.3

Value of "WL.Client.Push" is coming as undefined

I am getting the value for WL.Client.Push as undefined when launching the application. Hence, the below is coming as false.
if(WL.Client.Push)
And that's the reason my push is not getting registered.
Please advise how can I define WL.Client.Push.
This normally happens when you try to use WL.Client.* APIs before the SDK initialization has been completed.
The right point to start using the WL.Client APIs is after the flow has entered the wlCommonInit() method.
Do note that IBM MobileFoundation 7.x is out of support, and you should move to MobileFoundation 8.0.
You can use MFPPush object to invoke Push APIs.
Documentation here.
A working sample can be found here.

Are firebase messaging errors localized?

I am using firebase v4 to push notifications to android devices. When the Send method of the instance of messaging.Client fails, I only get a string error value and I wonder if this error string is localized. If not, I could compare it against e.g. "Requested entity was not found." to detect devices that have uninstalled my app. Is this string always plain english or does this depend on the locale the app is running under? Or does this error string come from the server, so I can never be sure if it stays the same?
What other options do I have to properly detect such an error, even if my golang binary runs on computer systems with any locale or language? I am running my golang binary on windows.
Any help or insights appreciated,
--
Stefan
In general, all error messages from Firebase SDKs are in English only. They are generally not suitable for display or comparison in an app. You should instead use the provided error codes (which will not vary) in the error or exception object to determine what exactly went wrong.

When is sessionReachabilityDidChange(_:) called on a watch WCSessionDelegate?

Apple's documentation says this in the discussion section of the method description:
This method is called to let the
current process know that its counterpart session’s reachability
changed.
The description of the isReachable property says this: WatchKit
extension. The iOS device is within range, so communication can occur
and the WatchKit extension is running in the foreground, or is running
with a high priority in the background (for example, during a workout
session or when a complication is loading its initial timeline data).
I am assuming this would mean that if the watch moves out of or into range of the iOS device, the WatchKit extension would be launched and the WCSessionDelegate's sessionReachabilityDidChange() method would be called, and the WCSession's isReachable would be true if the iOS device just came into range and false if it just when out of range.
I have not found a way to verify this in xcode. For example I put a log message in sessionReachabilityDidChange(_:) and walked out of range, but xcode simply says the app lost connection with the iphone and can no longer debug it. Can someone verify this or point me to some documentation that better describes this?
I think you cannot verify this in Xcode.
I have an app on iOS and watchOS. To check this kind of situation, I can enable debug alerts on iOS and watchOS. When func sessionReachabilityDidChange(session: WCSession) is triggered, I display a debug alert.
Now, if I run (not under Xcode) my watch extension, and then switch off the paired iPhone, the debug alert is shown on the watch.
This shows that sessionReachabilityDidChange is actually called as expected.
Apparently, under Xcode a connected iOS device is always reachable.
EDIT:
To check the situation when the watch extension is not in foreground, I did the following:
Instead of showing a debug alert, I set now the complication to a unique value that is not possible otherwise. I launched the watch extension and put it into background by showing the watch face with the complication.
When I now switch off the iPhone, the complication is not updated.
This indicates to me that sessionReachabilityDidChange is not called in background.

iOS 13 Schedule iOS background tasks

I am implementing BackgroundTasks Framework for updating the data. But I got the below issue
Could not schedule refreshApp: Error Domain=BGTaskSchedulerErrorDomain Code=1 "(null)"
Could not schedule data featch: Error Domain=BGTaskSchedulerErrorDomain Code=1 "(null)"
2019-10-01 19:19:32.550320+0530 SOBackgroundTask[34131:1129470] Can't end BackgroundTask: no background task exists with identifier 3 (0x3), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Here are possible error codes for Domain=BGTaskSchedulerErrorDomain extracted from ObjC headers with some explanation.
BGTaskSchedulerErrorCodeUnavailable = 1 // Background task scheduling functionality is not available for this app/extension. Background App Refresh may have been disabled in Settings.
BGTaskSchedulerErrorCodeTooManyPendingTaskRequests = 2 // The task request could not be submitted because there are too many pending task requests of this type. Cancel some existing task requests before trying again.
BGTaskSchedulerErrorCodeNotPermitted = 3 // The task request could not be submitted because the appropriate background mode is not included in the UIBackgroundModes array, or its identifier was not present in the BGTaskSchedulerPermittedIdentifiers array in the app's Info.plist.
The solution is to run on a device. I was running on a simulator. However, It was showing the Background App Refresh has been enabled in Settings while running on the simulator.
There may be some other reasons. Please visit
https://developer.apple.com/documentation/backgroundtasks/bgtaskschedulererrorcode/bgtaskschedulererrorcodeunavailable?language=objc
For:
BGTaskSchedulerErrorDomain error 3
Check inside the project’s .xcodeproj file for the appropriate target. Then go to the info tab and Custom iOS Target Properties and check that the permitted background task scheduler identifiers (BGTaskSchedulerPermittedIdentifiers) are added.
This solved my problem when adding BackgroundTasks to an existing project.
Please check if you miss registering BGTaskSchedulerPermittedIdentifiers in info.plist file of your project.
I have tested on real device(iOS13.2, and iOS13.2.2), but it's same result.
Error Domain=BGTaskSchedulerErrorDomain Code=2 "(null)"
Can't end BackgroundTask: no background task exists with identifier 37 (0x25), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Error Domain=BGTaskSchedulerErrorDomain Code=1 "(null)"
Can't end BackgroundTask: no background task exists with identifier 113 (0x71), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
It seems that there is still exist bug.
https://forums.developer.apple.com/thread/121990
I think this is because that your mobile turn the bg refresh off!!!!!!!
In case of BGTaskSchedulerErrorDomain error 3, I didn't add below
<array>
<string>com.shiny.job</string>
<string>com.shiny.jobpower</string>
<string>com.shiny.jobnet</string>
<string>com.shiny.jobpowernet</string>
</array>```
Just check the Background Modes has been added to the target Capabilities and that Background fetch and Background processing options are selected
According to https://developer.apple.com/documentation/backgroundtasks/bgtaskschedulererrorcode/bgtaskschedulererrorcodeunavailable?language=objc, this error usually occurs for one of three reasons:
The user has disabled background refresh in settings.
The app is running on Simulator which doesn’t support background
processing.
The keyboard extension either hasn’t set RequestsOpenAccess to YES in
The Info.plist File, or the user hasn’t granted open access.
The extension type isn’t able to schedule background tasks.
check you Appdelegate.swift is including WorkmanagerPlugin.registerTask(withIdentifier: "your.task.id")

Resources