ResponsiveVoice not working when page load - responsivevoice

Why this code works well on my Android Tablet (Samsung) + Desktop Windows 10 , but not on my 2 Android Phone (LG4) and Samsung 3
<script>
setTimeout(responsiveVoice.speak("Welcome to the Responsive Voice website"),15000);
</script>
Calling this function has exactly the same problem (works on tablet but not on phones):
function x() {
responsiveVoice.speak("Hello");
}
function y() {
x();
}
y();

Related

Flutter web PWA install prompt from within the app

I'm working on a Flutter Web PWA app and having trouble with triggering the Add To Home Screen prompt from within the flutter app. I understand it can be triggered using Javascript with the code below, but how do I do this from my Flutter dart file?
buttonInstall.addEventListener('click', (e) => {
// Hide the app provided install promotion
hideMyInstallPromotion();
// Show the install prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
deferredPrompt.userChoice.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the install prompt');
} else {
console.log('User dismissed the install prompt');
}
})
});
Currently, Flutter web can only prompt PWA installs from the browser. The issue with displaying PWA install prompt is it breaks the compatibility/design with Android/iOS builds as the feature is web-specific.
A different approach that you can take here is by displaying "PWA install" reminders when the app is run on web. Otherwise, it's best to file this as a feature request.
I created the pwa_install package specifically for this purpose.
1. Update index.html
<!-- Capture PWA install prompt event -->
<script>
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
deferredPrompt = e;
});
function promptInstall(){
deferredPrompt.prompt();
}
// Listen for app install event
window.addEventListener('appinstalled', () => {
deferredPrompt = null;
appInstalled();
});
// Track how PWA was launched (either from browser or as PWA)
function getLaunchMode() {
const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
if(deferredPrompt) hasPrompt();
if (document.referrer.startsWith('android-app://')) {
appLaunchedAsTWA();
} else if (navigator.standalone || isStandalone) {
appLaunchedAsPWA();
} else {
window.appLaunchedInBrowser();
}
}
</script>
2. Call PWAInstall().setup()
You can call this method in main.dart before calling runApp()
Future<void> main() async {
// Add this
PWAInstall().setup(installCallback: () {
debugPrint('APP INSTALLED!');
});
runApp(MaterialApp(home: App()));
}
3. Check if the Install Prompt is enabled
Before calling the promptInstall_() method, you can check if the Install Prompt is available using PWAInstall().installPromptEnabled.
installPromptEnabled will be true if:
The app was launched in a browser (It doesn't make sense to prompt a PWA install if the app is already running as a PWA)
The beforeinstallprompt event was captured.
promptInstall_() won't do anything if installPromptEnabled is false so you should check this flag before attempting to call the prompt.
4. Call PWAInstall().promptInstall_()
Finally, call PWAInstall().promptInstall_() to show the install prompt.
Note that this will not work on Safari since Safari does not implement the beforeinstallprompt method this package relies on.

In the React app, downloading an image from an iPhone to wi-fi is very slow, on the mobile Internet it’s excellent. Has anyone come across?

There is an application written in React. Images are loaded using the following code:
<input type='file' id='single-file' onChange={props.onChange}/>
onChange = e => {
let ua = navigator.userAgent;
let is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
if (is_ie === true) {
let file = document.getElementById('single-file').files[0];
this.props.uploadImage(file);
this.props.openUpload(true);
} else {
this.props.uploadImage(e.target.files[0]);
this.props.openUpload(true);
e.target.value = '';
}
};
sent as standard with axios module using FormData.
When testing, it was found that from the PC, and Android phones, sending files happens quickly and normally. But on the iPhone on the mobile Internet of the network, the photo is sent perfectly, but it takes about two to three minutes with wi-fi. Different iPhones (X, XR, 6, 7), different browsers, different wi-fi networks were tested - the result is the same.
Maybe someone faced a similar problem?

Customized IME in Samsung Smart TV

I am developing a app for Samsung Smart TV in which i have to implement search functionality.
I am using IME for taking input, like this:
I included
<script type='text/javascript' src='$MANAGER_WIDGET/Common/IME_XT9/ime.js'></script>
in body tag and then in JS
ime = new IMEShell("txtSearch", ime_init_text, "en");
if(!ime){
alert("object for IMEShell create failed", 3);
}
function ime_init_text(imeobj)
{
var inputobj = imeobj.getInputObj();
alert("start initializing : "+inputobj.id);
var pluginAPI = new Common.API.Plugin();
pluginAPI.registIMEKey();
// ime.setKeypadPos(410, 80);
imeobj.setQWERTYPos(200,150);
imeobj.setEnterFunc(keypadEnter);
ime.setAnyKeyFunc(onAnyKey);
ime.setStatusOKBtn(onKeyOk);
alert("ime_init end...");
}
A nice qwerty keypad is coming, but i am unable to make its width equal to screen size of TV and handle its OK and Cancel button click events. Can someone help with this.

iPhone URL Schema block safari error alert

I tried open my app if installed in iPhone from safari browser simply passing like myApp:// using javascript document.location="myApp://"; if not redirect to another webpage to display app details. but when app not installed safari throw "Cannot open Page" alert ,if redirect to another webpage that time also safari alert box not dismiss automatically.
Any one help me to how redirect the webpage without safari cannot open page alert if app not installed on device.
My Code :
Simply html file and body onload="checkdevice();return false;"
display message in textarea "document.getElementById('txtMsg').value"
function checkdevice() Check browser detection
{
if((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPad/)) || (navigator.userAgent.match(/iPod/)))
{
document.getElementById('txtMsg').value ="Running on iPhone /iPod /iPad Device";
checkAppExists();
return true;
}
else
{
document.getElementById('txtMsg').value ="Please run this page on iPhone / iPod / iPad Device";
checkAppExists();
return false;
}
}
function checkAppExists()
{
var time = (new Date()).getTime();
window.location="myApp://";
setTimeout(function(){
var now = (new Date()).getTime();
if((now-time)< 400)
{
window.location="http://mydomin.com/appdetails.html";
}
else
{
document.getElementById('txtMsg').value ="App Installed"; * App will launch here *
}
},300);
}

differentiate between iPhones and iPads

I'm working on my mobile site, I already have this code:
<script type="text/javascript"> // <![CDATA[
if ( (navigator.userAgent.indexOf('Android') != -1) ) {
document.location = "android.html";
} // ]]>
</script>
which diverts android users away from the current page on to androids own dedicated page.
what I would like to do is the same thing but for an iphone / ipad. I would like iphone / ipod touch to land on iphone.html and ipad to land on ipad.html displaying different content for both. How can I do this?
thank you.
You can just expand your current approach to the other user agents:
var iphone = ((window.navigator.userAgent.match('iPhone'))||(window.navigator.userAgent.match('iPod')))?true:false;
var ipad = (window.navigator.userAgent.match('iPad'))?true:false;
if(iphone){
document.location = 'iphone.html';
}
if(ipad){
document.location = 'ipad.html';
}