I am trying to create a Toast in a Tizen app. The Toast will be running outside context of my app. However, I am not able to find any example which works yet.
Here is what all i have tried so far:
function toastAlert(msg) {
$('#popupToastMsg').empty();
$('#popupToastMsg').append(msg);
$('#popupToast').fadeIn('slow');
setTimeout(function() {
$('#popupToast').fadeOut('slow');
}, 2000);
console.log(msg);
}
function sendAlert() {
toastAlert('ToastWorks');
}
The above code generates in app message not a toast. Even https://github.com/search?l=javascript&q=tizen+toast&type=Code&utf8=%E2%9C%93 does not help much. Can anyone suggest a better approach and a way to do same.
You can't make popup like toast out of your web application.
Current Tizen web application don't support it.
but I think maybe you can use notification api for your job.
Related
I'm writing a web app for Tizen Smart TV. One of the required features is implementing the Smarthub Public Preview deeplinking.
I have setup the app to open at a specific content when the Public preview tile is clicked. However, I cannot prevent the app to reload. The documentation mentions adding the appcontrol event to the window event listeners, but I don't think this event is being recognized by the app, since the code is not executed.
It only works if I directly add my deeplink() method to the onload property.
According to documentation, this piece of code should prevent the app to reload, but it is not working:
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
<tizen:operation name='http://samsung.com/appcontrol/operation/eden_resume'></tizen:operation>
</tizen:app-control>
window eventListener is not working wither:
onload="window.addEventListener('appcontrol', deepLink)"
Any help on how to implement this correctly?
Thank you in advance
You are probably modyfing window.location in the app (ie in router).
reload='disable' prevents reloading index.html. When application receives app control request and page is different, application will be reloaded.
You can find more about appcontrol in Tizen documentation (note that Tizen for TV may differ from other devices):
https://docs.tizen.org/application/web/guides/app-management/app-controls/
I've got some information regarding your question.
To do application resume without Page reload,
Set extra data in app-control like below
key: SkipReload
value: Yes
Specifically, I would like to share granular page content via triggering the iOS share sheet with in-page buttons.
In my webapp page, I have a table of downloadable PDFs. I would like to be able to add a column called "Share" into the table, so that a button could be tapped to share the URL to that document, without having to open the document itself and share from there.
In order to do this, I assume I would need to customise this triggered share sheet to share a different URL to the one that is showing in mobile safari's address bar.
Is this possible using javascript, or alternative URLs in a meta tag maybe? I don't expect URL scheme to be a solution, as it is concerned with sending data to another application.
Addendum 6/2020 It is possible since iOS 12.4, it works great.
It will be supported in Safari iOS V12.2. The beta of V12.2 already has it.
There's a good article by Maximiliano Firtman on a number of new features that will be possible in the new version.
Not currently on ios but a new w3c spec is on the way called web share api. Currently only available in chrome for android behind a origin trail.
https://developers.google.com/web/updates/2016/10/navigator-share
Yes, via the Web Share API
per the w3 docs:
shareButton.addEventListener("click", async () => {
try {
await navigator.share({ title: "Example Page", url: "" });
console.log("Data was shared successfully");
} catch (err) {
console.error("Share failed:", err.message);
}
});
Great article by Joe Medley on web.dev: Integrate with the OS sharing UI with the Web Share API
I have found a bug using the external controls for the html5 widget on iOS, i have tested with iphone and ipad. The controls inside the widget work ok. However on my clients site http://www.bushytunes.net and the widget api playground http://w.soundcloud.com/player/api_playground.html the external controls run an error.
Here is what the console from the widget playground prints:
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PAUSE {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.PLAY {"loadedProgress":null,"currentPosition":0,"relativePosition":0}
SC.Widget.Events.READY {}
Loading...
Thanks, James
TL;DR: iOS 6 should work with a limitation of a call to play to be init by user action, iOS5 and below probably won't get a fix.
We'll try to resolve this with some kind of a hack, but most probably this won't get a proper solution any time soon.
SoundCloud Widget is using HTML5 Audio to play sounds on iOS. There are two limitations on starting playback in iOS:
Playback must be started by user action (so within event handler)
The call to audio.play method has to be within synchronous call stack of that event handler.
This means, that this works:
document.querySelector('.play-button').addEventListener('click', function () {
audioController.play();
}, false);
But this doesn't:
document.querySelector('.play-button').addEventListener('click', function () {
setTimeout(function () {
audioController.play();
}, 500);
}, false);
Cross-domain communication between iframes is only possible in asynchronous manner. Our implementation is using postMessage DOM API, but even older techniques such as Fragment Identifier Messaging (FIM) that is using location.hash are asynchronous. This means we don't currently see a way of enabling playback through API for iOS5 and below (as there is also no Flash fallback).
However, there are also good news: iOS6 has dropped the limitation No2. This means that as long as the API call to play is called by user action, you'll be able to play sounds. Even though the communication between your parent window and widgets' iframe is still async. Unfortunately iOS hasn't dropped this limitation.
I hope this helps and I'll update this answer in case we find a proper workaround.
My suggestion would be to build your own custom player with a library like Audio5JS or SoundManager2 in case controlling playback on iOS is crucial for your app.
You can see vague description of what I am talking about on developer.apple.com resource.
I can't completely tell if #gryzzly is trying to say this, but the Widget API's external controls are completely broken on mobile. The answer does explain why -- you can't synchronously tell the iFrame to play the sound, but it is my understanding that proper iframe.contentWindow calls would be synchronous? I may be wrong.
Try directing your mobile phone to the widget API playground: https://w.soundcloud.com/player/api_playground.html
Even there it doesn't actually play unless you press the orange button.
Pretty irritating since there's no application to get around the streaming API limit either. There seems to be literally no way to get a site that may experience more than 15,000 requests/plays per day to work with SoundCloud on mobile. I just want continuous music playback.
This might be a easy question but i couldn't find solution. I want to open AppWorld by clicking a button in my BB application. For example when user clicks this button Appworld will show "Facebook Application" page. Can i do this?
In Android platform this line launches GooglePlay for Facebook App. Does BlackBerry supports this kind of method?
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.facebook.katana")));
Here is a simple way to do this:
Browser.getDefaultSession().displayPage("http://appworld.blackberry.com/webstore/content/2360/?lang=en");
Above code will invoke the browser in the application and open the BlackBerry App World, I tested it in device and it's perfectly working. For now I put a Whats App messenger link, but you can customize the link according to your requirement.
You can open App World from your BB application directly using the following code. This code avoids opening the browser first.
Registry registry = Registry.getRegistry(this.getClass().getName());
Invocation invocation = new Invocation(null, null,
"net.rim.bb.appworld.Content",
false, ContentHandler.ACTION_OPEN);
invocation.setArgs(new String[] { /* app id in appworld */ });
registry.invoke(invocation);
I have downloaded the file structure of my JQuery Mobile app. I have done this to test running it from the local file system. The reason why is I want my app to run with Cordova. From my understanding cordova runs files under file://. Currently, my file structure looks like this:
index.html
account
register.html
reset.html
In index.html, I have a "sign up" button. When someone clicks it, I use the following code:
$.mobile.changePage("account/register.html", { transition: "slide" });
I've verified that register.html works fine if i put the complete path in the browser url. Oddly, I see "error loading page" when I click "sign up". Is there some problem with using changePage under file://. If so, how do I overcome this?
Thank you!
try this
$.mobile.changePage("../account/register.html", { transition: "slide" });
You can just leave .. links in the code and it will work fine. Unless you have a reason to explicitly call changePage.
This answer is specificly if you run into an issue running the PhoneGap app on iOS.
Be sure you set the $.mobile.allowCrossDomainPages = true; which is required for AJAX calls to inject pages.
In your PhoneGap app object definition:
var app = {
initialize: function() {
// setting required to use $.mobile.changePage()
// http://jquerymobile.com/demos/1.2.0/docs/pages/phonegap.html
$.mobile.allowCrossDomainPages = true;
},
};
So when you call app.initialize() in your index.html, this property will be set prior to any $.mobile.changePage() function calls.
This will save you hours of trying to figure out the issue as no error is returned via the Safari Web Inspector.