- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello guys,
I hope someone can help me,
i made an textbased app for android. I want user to push on a button and the text above will be copied and used on the clipboard of the phone.
I now have this:
<button onclick="copyToClipboard('Text that i want to copy on the phone');">Copy text button</button>
And this:
<script type="text/javascript" language="javascript">
var isIntel=window.intel&&window.intel.xdk
// This event handler is fired once the intel libraries are ready
function onDeviceReady() {
//hide splash screen now that our app is ready to run
intel.xdk.device.hideSplashScreen();
setTimeout(function () {
$.ui.launch();
}, 50);
}
//initial event handler to detect when intel is ready to roll
document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);
//Test for javascript interface "intel.xdk.device.copyToClipboard()".
function copyToClipboard(text){
intel.xdk.device.copyToClipboard(text);
}
intel.xdk.device.managePower(true,false);
</script>
The device plugin is loaded but the button doesn't work.. I need the buttons on every page so the users can copy my text.
Thankyou :)
- Tags:
- HTML5
- Intel® XDK
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not believe the copyToClipboard() function will work in a webview. Your app does not run inside a browser, it runs in a special runtime environement known as a webview. While it appears like a browser, it is not. I suspect you need to find a Cordova plugin that will allow you to copy data into the platform-specific clipboard.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page