Why the activity under google assistant go onPause in Android TV? - android-tv

I am working an app on android tv.
We are discussing about the reason why activity go onPause when Google Assistant is active.
We found this problem happened suddenly in one day.
After tracing this problem for many days, we found that Assistant page cover on our app as a activity.
That's the reason why my app go onPause.
But I want to know the reason why it could suddenly become an activity.
Here is my observation of activity.
I use "adb shell dumpsys activity" to check activity status.
Without going to onPause situation
Running activities (most recent first):
Run #0: ActivityRecord{2d9fe0 u0 com.google.android.katniss/com.google.android.apps.tvsearch.app.launch.trampoline.SearchActivityTrampoline t12 f}
Running activities (most recent first):
Run #0: ActivityRecord{32ee7d7 u0 com.sv.n973796_home/.atv.ui.HomeActivity t5}
Running activities (most recent first):
Run #0: ActivityRecord{f0c9842 u0 com.sv.n973796_home/.LauncherMainActivity t3}
Going to onPause situation
Running activities (most recent first):
Run #0: ActivityRecord{bdce69a u0 com.google.android.katniss/com.google.android.apps.tvsearch.results.activity.SearchResultActivity t825}
Running activities (most recent first):
Run #2: ActivityRecord{87c5fd1 u0 com.sv.n973796_home/.common.ui.HomeActivity t817}
Run #1: ActivityRecord{28d1d6c u0 com.sv.n973796_home/.LauncherMainActivity t817}
My questions here:
Is there any document about this changing?(between "com.google.android.apps.tvsearch.app.launch.trampoline.SearchActivityTrampoline" and "com.google.android.apps.tvsearch.results.activity.SearchResultActivity")
Does this problem relate to my SDK version?(sdk version in gradle or SDK manager?)
Is there any way to check the version of com.google.android.katniss? and could I choose it?

There is no specific documentation about this changing. It's due to a change with how ATV Assistant is implemented.
No. It is entirely based on which version of ATV Assistant is on the device.
You can manually check the ATV Assistant version in system settings (Apps -> All Apps -> Show system apps, Google). You may be able to programmatically determine the version on the device by checking package manager (I don't recall if that requires a permission), but you don't want to do that. You can't guarantee that the behavior will be the same in different versions and updates are being regularly released.
I'd ask what specific issue you have with onPause being triggered (or not triggered) and start from there because ATV Assistant isn't the only reason that onPause could be called. For example, if your app handles video playback you would want to stop the player in onPause() in Android 6.0 and earlier and then in onResume() you would check if it was playing when onPause() was invoked and trigger playback again if it was. You shouldn't care about whether onPause() was invoked due to the Assistant coming to the foreground or the OS displaying an alert dialog. In versions of Android after that, you can simply have that logic in onStop/onStart, since the onStop() lifecycle method is guaranteed to be called quickly when the activity is no longer visible.

Related

Missing videoTrack in a multitrack stream in Ant media server 2.4.1

We have a Multitrack web conference implementation using AMS 2.4.1 version. Its working great for our use case, except in one scenario. When there are N (< 3) number of users and they on there camera simultaneously, then few remote users are not rendered as we don't receive the video tracks for those users in newStreamAvailable. We only receive the audio track for those users. We are able to reproduce this quite frequently.
As a backup, I am trying to poll AMS using getTrackList with the main track Id to get all available streams, but I am not getting any message trackList
var jsCmd =
{
command : "getTrackList",
streamId : streamId, // this is roomId or main track id
token : token
}
Any insight would be helpful.
Thanks,
We were able to resolve the issue, posting here to help anyone who might be facing a similar issue.
With push notifications from the server, we might encounter issues when for some reason push operation doesn't succeed. In that case, it's better to have a backup plan to pull from the server and sync.
The Ant Media Server suggests pulling the server periodically for the room info. The server will respond with active streams and the application should synchronize.
For reference, please refer to following link https://resources.antmedia.io/docs/webrtc-websocket-messaging-reference

Error while sending trade commands to bybit testnet

I am using Alertatron to send manual alerts to bybit testnet exchange. I am getting the following error log. Please let me know what the issue is
======error start==
[v283, bybit, jothibybit, EOSUSD] ::: market(side=buy, amount=1);
Script market v1.0.0, by Alertatron
using buy offset of 0 from 2.884 (current price) --> 2.884
[bybit, jothibybit, EOSUSD] Executing market order to buy 1.
Not enough margin to cover order that size [post /v2/private/order/create] - status code: 30031
Session 40b71524 has no more commands to process on bybit (jothibybit), EOSUSD - waiting for background processes...
bybit : jothibybit : No active background processes for EOSUSD. Done.
Session 40b71524 finished waiting for related background tasks
Request to close exchange connection bybit, jothibybit. Not being used any more.
Bybit closed
Bot entering idle state - updating to latest release.
===end log
my code
jothibybit(EOSUSD){
exchangeSettings(leverage=cross);
cancel(which=all);
market(side=buy, amount=1);
}
#bot
Generally that error means that you do not have enough money on your Bybit account to execute the trade.
The reason for that can be, that you have not enough money, then you need to reduce the trade size, or you are trying to execute the trade from a subaccount, which is somehow not working properly. in case you are using a subaccount API Key on Bybit, try to execute the trades using a Main Account API Key.
In both cases double check on Alertatron if you have access to the Bybit balance, by running a Manual Alert:
https://alertatron.com/docs/automated-trading/balance
While you are executing that test trade, you should open the "live bot output" in Alertatron, to see the response you get from Bybit.
If that works, try to execute an example trade:
https://alertatron.com/docs/automated-trading/api-keys-bybit

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.

How to check if the biometric scanner is available and initialized in Xamarin android BiometricPrompt

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.

HKWorkoutSession isn't keeping app at front of Apple Watch

It has been stated that an app running a HKWorkoutSession will have special privileges over other watchOS 2 apps, so when a user looks at their Apple Watch, it will go to the view showing running a workout rather than the watch face.
Currently, on both my device and simulator, this is not the case. If I start a HKWorkoutSession and then leave for 5 minutes and then interact with either the Apple Watch, or the Watch Simulator, it presents the watch face.
If I then open my app, it appears to have been frozen, rather than terminated (which is what I imagine happens to other apps). As the UI will update when I need receive a response in my query.updateHandler. Also if I set it to provide haptic feedback every time my query.updateHandler receives a new HKQuantitySample it will do so, so the app must be running in the background in some form.
Has anyone else noticed this behaviour, and am I doing anything wrong, or expecting something I shouldn't?
Here is how I start my HKWorkoutSession:
self.workoutSession = HKWorkoutSession(activityType: HKWorkoutActivityType.Other, locationType: HKWorkoutSessionLocationType.Indoor)
self.healthStore.startWorkoutSession(self.workoutSession) {
success, error in
if error != nil {
print("startWorkoutSession \(error)\n")
self.printLabel.setText("startWorkoutSession \(error)")
self.printLabel.setTextColor(UIColor.redColor())
}
We're seeing that too, for the moment we've made sure 'opens last activity' is configured.
When the UI is active we start a dispatch_timer to request and process data in 1 second intervals.
Make sure you do any significant processing using the NSUserProcessInfo method though and pause the dispatch_timers whenever you are no longer active. You'll get crashes otherwise.

Resources