Samsung Smart Tv Return Button - samsung-smart-tv

I created the app for the samsung smart tv. I tested my app using the Remote test system. All the functionalities are working properly except the return key. When i press the return button it is returning to the home screen but i want my app to return to the previous screen of my app. This is working correctly while i test this in the emulator.
I checked this by giving alers in the return key functionality. It is alerting that after it is returning to the homw screen.
Can anyone help me in this

RETURN and EXIT key are followed by default behavior to closing application and going back to smart hub or tv broadcast screen.
You should implement prevent default behavior, please look at this page: http://samsungdforum.com/Guide/ref00009/sfkey_preventdefault.html

In Samsung Smart TV, RETURN default action is return to Home, as you can see in SDK documentation:
http://www.samsungdforum.com/Guide/
You must to include this line in your code:
sf.key.preventDefault();
Before your code to customize RETURN button action.
For example (case from a Switch):
case tvKey.RETURN :
sf.key.preventDefault();
window.history.go(-1);
break;

I was facing the same problem for a basic Javascript project. I resolved it by adding event.preventDefault();, for example:
Main.keyDown = function()
{
var keyCode = event.keyCode;
case tvKey.KEY_RETURN:
case tvKey.KEY_PANEL_RETURN: event.preventDefault();
}
For Apps Framework you can use this function:
sf.key.preventDefault();

Related

Ionic Android Strange routing when physical key is pressed [Honeywell CK65]

We are developing Ionic android app and we are having a strange problem with Honeywell CK65 device, to be more specific with device physical keyboard.
If the app is being used only by touch, without device physical keyboard, the app is working correctly.
But when physical keyboard is used, example
when ENTER key is pressed, it should navigate to another page but the remain freeze and it appends on the bottom page the previous page.
Any help will be appreciated. thanks in advance.
You need to somehow configure the app to use the devices keyboard. My guess is that you need to create a custom plugin to call the device's built in keyboard and map those keys to a function.
We resolved the problem using ionic ion-router-outlet instead of angular router-outlet

Has the iOS9 update caused C# codes not work properly?

I have a piece of code which is not working after the iOS9 update on devices, specifically Safari browser (Both iphone and ipad). It works fine in Chrome on the device using iOS9 but Safari is having sme kind of issue which I'm unable to debug. There was no issues in both the browsers on the device till iOS8.
Basically the functionality is a person needs to select 2 images from a set of images and click the GO button. If the images match with the ones saved at backend(DB) then he gets navigated to the next screen, else it shows a Cross symbol and refreshed the page asking the User to select the images again.
Please help and thanks.
Below is the piece of code which I feel is having the issue :
string cbref = Page.ClientScript.GetCallbackEventReference(this,
"arg", "fnGetOutputFromServer", "context");
string cbScr = string.Format("function fnCallServerMethod(arg," +
" context) {{ {0}; }} ", cbref);
Page.ClientScript.RegisterStartupScript(GetType(), "fnCallServerMethod", cbScr, true);
I put an alert within fnGetOutputFromServer but that never showed up in the device Safari browser. Please help me as I feel totally confused as to why it is not working. Also, I'm okay if I have to change the whole line to put a work around to this or by directly calling the function or something.
Note : This works fine in Chrome on an iOS9 device but does not work in Safari and the same works fine while emulating as iphone/ipad on the PC
Thanks again in advance.
http://www.brillianceweb.com/blog/article/69/aspnet-20-misidentifies-safari-71-on-ios-and-os-x
This fixed it !!! :)
I had to get the latest AppleWebkit version for iOS9 and got it updated in the configuration file which resolved the issue

How to open url in Safari and the get back to the app under UITests in Xcode 7?

This is my custom view where "LondonStreet" is a button.
When I tap that button I get url and open it in Safari (it works). Then I can go back, using "Back to Wishlist" button (it also works).
The problem is when I try to test this under UITests.
itemsTable.cells.elementBoundByIndex(0).buttons["addressButton"].tap() //press the button to open link in Safari
Along with this line:
app.statusBars.buttons["Back to Wishlist"].tap() //go back, doesn't work, although it was recorded by Xcode itself.
is an error:
UI Testing Failure - Failed to get screenshot within 5s.
And also in issue Navigator
UI Testing failure - Unable to update application state promptly.
Starting in iOS 11 you can interact with other applications using the XCUIApplication(bundleIdentifier:) initializer.
To get back to your app you'd do something like:
let myApp = XCUIApplication(bundleIdentifier: "my.app.bundle.id")
let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
// Perform action in your app that opens Safari
safari.wait(for: .runningForeground, timeout: 30)
myApp.activate() // <--- Go back to your app
UI Testing cannot interact with anything outside of your application. In your scenario, the framework can no longer do anything once your app opens Safari.
To verify this, try printing out the app's hierarchy once Safari opens. You will notice that nothing in Safari nor the navigation bar will show up - you will only see your app's information.
print(XCUIApplication().debugDescription)
To open specific url in Safari on iOS 15:
safari.textFields["Address"].tap()
safari.textFields["Address"].typeText("www.urlToOpen.com")
safari.keyboards.buttons["Go"].tap()

Html forms and mobile web browsers problem

Mobile keyboard (Android IPhone) has no tab button. That is why native application go to next field when enter is pressed. However browser forms are submitted when enter is pressed.
How can I solve this problem?
Use tabindex properly and it should work just like with native applications.
By the way, on Android at least, native apps don't have to do anything special to get this behavior (at most they have to specify nextFocusForward, if the layout is too complicated and Android can't figure that out by itself).
I assume you're talking about the on-screen keyboard. iPhone will show Previous | Next as a keyboard accessory in web forms. Android will too.
If they don't then something might be wrong with your markup. Is it possible for you to post your form HTML code?
I would also say that nLL's suggestion is correct. It will make it feel more polished.
since you are targeting high-end phones you can handle enter key with simple JavaScript
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
//Do something
}

Native HTML5 Drag and Drop in Mobile Safari (iPad, iPod, iPhone)?

I've successfully implemented native HTML5 Drag and Drop for moving HTML elements inside a page (just, say, a div from one place to another, nothing related to interacting with the host OS' files whatsoever). This works fine in Chrome and Safari on a PC but I can't start a drag operation in my iPad's Safari.
I've found this so far:
Using Drag and Drop From JavaScript
Safari, Dashboard, and WebKit-based
applications include support for
customizing the behavior of drag and
drop operations within your HTML
pages.
Note: This technology is supported
only on desktop versions of Safari.
For iPhone OS, use DOM Touch,
described in Handling Events (part of
Safari Web Content Guide) and Safari
DOM Additions Reference.
Here. But it's outdated (2009-06-08).
Doe's anyone know if it is possible to use native HTML5 in Mobile Safari? (I don't want javascript-framework like solutions like jQuery UI).
Thanks!
I've just been trying to get native drag&drop working in ios safari (ipad pro with 14.0.1), and I'm updating this answer as it kept coming up as my first google result (and no other q&a seems to be up to date).
Following https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/SafariJSProgTopics/DragAndDrop.html
I have found native html5 drag&drop now works in safari, with a few specific notes;
You MUST set some data in OnDragStart's event; (the effect settings seem to be optional) Event.dataTransfer.setData('text/plain', 'hello');
you MUST Event.preventDefault(); in OnDrop otherwise safari will load the data you added (unless that's your intention)
OnDragOver event handler needs Event.preventDefault(); otherwise drop fails (unless intended, as docuemnted)
On ios safari, if you set OnDragStart's Event.dataTransfer.dropEffect='copy' and in OnDragOver's Event.dataTransfer.dropEffect='link' the drop fails (no OnDrop()); Seems to be the only combination that fails
I thought you required
CSS -webkit-user-drag: Element; and `-webkit-user-drop: element;
or if you prefer
Element.style.setProperty('webkitUserDrag','element');
Element.style.setProperty('webkitUserDrop','element');
but it seems just the usual draggable attribute is enough
Element.setAttribute('draggable',true);
This seems to be the bare minimum to drag & drop an element
Element.setAttribute('draggable',true);
function OnDragOver(Event)
{
Element.setAttribute('DragOver',true);
Event.stopPropagation(); // let child accept and don't pass up to parent element
Event.preventDefault(); // ios to accept drop
Event.dataTransfer.dropEffect = 'copy';// move has no icon? adding copy shows +
}
function OnDragLeave(Event)
{
Element.removeAttribute('DragOver');
}
function OnDrop(Event)
{
Element.removeAttribute('DragOver');
Event.preventDefault(); // dont let page attempt to load our data
Event.stopPropagation();
}
function OnDragStart(Event)
{
Event.stopPropagation(); // let child take the drag
Event.dataTransfer.dropEffect = 'move';
Event.dataTransfer.setData('text/plain', 'hello');
}
Element.addEventListener('dragstart',OnDragStart);
Element.addEventListener('drop',OnDrop);
Element.addEventListener('dragover',OnDragOver);
Element.addEventListener('dragleave',OnDragLeave);
Touch events do work now on Safari too (including Mobile). This article has nice code snippets that you can start from:
http://www.html5rocks.com/en/mobile/touch/