How to let a SmartWatch vibrate from an HTML5 page without intervention - android-vibration

As I have developed a solution for people with Alzheimer’s, Dementia and for instance an Autisme Spectrum Disorder, that normally is shown on tablets (see www.dontforgetit.eu), I have made also an Android APP to be installed on a SmartWatch.
This app is developed with Android Studio and has an HTML5 background (as for the tablets).
What I do is I start with a page that needs to be tapped. It vibrates and that goes to the actual HTML5 page showing upcoming appointments and other obligations. The maximum ages shown is three (a clock, the actual event and the upcoming event). The upcoming event is only shown 5 minutes before the actual event terminates. Three minutes before the actual event stops and the upcoming events starts, the SmartWatch needs to vibrate.
For that reason I start with the earlier mentioned start page. However I get the following message "Blocked call to navigator.vibrate because user hasn't tapped on the frame or any embedded frame yet: https://www.chromestatus.com/feature/5644273861001216.” and the Watch doesn’t vibrate.
How do I solve this problem, preventing the disabled person to continue tapping the Watch?

Related

Multiple time pickers on one screen make app freeze on phones with iOS15+ only

The backend of this app was made with ExtJS. The frontend is Objective-C, where the webpages are displayed with a WKWebView. It is legacy, and there is no documentation or people with knowledge or experience within the company regarding the app.
My app freezes when I select a new time picker.
I have multiple (4) native time pickers on one screen, which are displayed in a web page through WKWebView.
Whenever the user closes the picker by selecting the screen anywhere but on the picker, and choosing another one of the remaining three relatively quickly (within 1 second), the app freezes.
The app will not freeze:
When the same date picker is selected.
When the user selects 'Done'.
When the user waits 1 to 2 seconds before selecting a new time picker.
The time pickers work fine on any device older than, but not including, iOS 15.
On iOS 15 and above, the freezing only occurs when the OS is iOS (phone), but never on iPadOS.
I have tried setting definesPresentationContext to true, but to no avail.
I could not find any other developers with this kind of issue on the internet, which is why im resorting to StackOverflow.
The error that arises:
[Presentation] Attempt to present <_UIDatePickerContainerViewController: 0x15303b6e0> on <ViewController: 0x150d068f0> (from <ViewController: 0x150d068f0>) which is already presenting <_UIDatePickerContainerViewController: 0x150e16650>.
So my question is, is there anyone else that has experienced freezing because of time pickers on iOS15+ with phones only?

Show advertisement at regular interval of time when iPhone is running

I am working on the app that shows Ads (Video or image) when iPhone is running. If I open any app(eg. Twitter) then also my Ads should be visible at particular interval of time. Is it possible to do so?
No. Your app will not be informed about any other apps being launched. Even if it were, you can't "force-grab" the foreground to display videos. That would totally violate any user interface principle established by iOS.
Besides the technical aspect I'd have my doubts of such an app surviving app review in general, though I don't know the specific part of the TOS right now.
It is possible to show your ads inside your application in intervals or in any pattern you like. However it is not possible to bring your app to foreground when in background to play ads, it is actually not recommended at all. Best thing you can do is set a timer when the app gets in background to send a notification.

VoiceOver stops announcing UIAccessibilityPostNotification messages

I'm working on an application that is designed to speak some information about the data it captures from video as the video is being captured. Right now I'm using UIAccessibilityPostNotification to get VoiceOver to say what I want it to say with UIAccessibilityAnnouncementNotification. This typically works great until the user attempts to navigate between my UI controls. After swiping back and forth along the elements (a menu and an info button) a little bit, the application stops speaking the persistent notifications. I also find that posted notifications do not announce if I background the app and then return it to the foreground
I have a magic tap handler that pauses and resumes that persistent announcement and once it is triggered (which also triggers speech about the last rendered info), manually triggered speech works again and upon resume from a second magic tap the announcements continue as if nothing had stopped.
Is there a mechanism to get voiceover to reliably resume speaking without requiring some other kind of user-screen input in between?
Fortunately this was, following the rule of "it's probably your own code's fault first", my own fault. A timer was inadvertently changing the state of things and what I was using to track when to announce was being set to an invalid state which stopped the announcements.

How to avoid an Apple Watch 2 App to stop running after a few seconds the screen turns into black?

I am developing an Apple Watch2 App. My app stops running after a few seconds the screen turns into black but I want my app to run on the screen even after the screen turns into black. So that the user can see my app anytime on the screen by not tapping to the app icon again.
I tried to add a timer and then an animation and also made dynamic UI changes to avoid my app to stop running but it didn't work - after a few seconds the screen turns into black, the app stops and the main watch clock screen comes into display.
I saw that it is possible to do this functionality in "Apple Workout App". When the user starts a timer, even if the screen turns into black, the app doesn't stop running so the user checks the timer anytime she/he wants. So please let me know how I can get this functionality?
Thanks,
E.
You can't control this from your app; The user selects the behaviour for their watch using the Apple Watch app on their phone. They can select "Show watch face" (the default) or "Resume Last Activity". They can also select how long the display stays on for on a tap; either 15 or 70 seconds.
Some Apple apps such as Maps, Remote and Timer can override this setting and if a fitness app has an active HealthKit workout activity then the watch will also resume the last activity on wrist raise/face tap. If your app isn't using HealthKit for a workout activity then you have to live with the behaviour the user has selected.

Monodroid: wake application

How is it possible to wake the application from code?
I am writing a simple timer and when time goes out it displays picture on main activity. But this means that application should stay on screen all the time. If user switches to another app (or simply presses Home) my Activity is no longer visible and I need to show it on screen again (switch back to my application) in the way similar to standard Android Phone or Timer pops up.
So there actually are 2 questions:
How to get application on "top" of screen?
How to correctly display application when screen is locked?
For that you would need a service that starts your activity when that timer triggers.
You can take a look at the Android Alarm Clock source code for how to have an Activity Shown even on the lock screen: https://github.com/android/platform_packages_apps_alarmclock/blob/master/src/com/android/alarmclock/AlarmAlertFullScreen.java
Note especially lines 85 to 90, here flags are added so that it is allowed to be shown on the Lock Screen. This should of course work with Mono for Android as well.
There is also a nice answer here to your questions: Wake Android Device up
It should be fairly easy to port to Mono for Android.

Resources