Permalink
Browse files

Merge pull request #6 from webworks/next-onInvokedDemo

Next on invoked demo
  • Loading branch information...
2 parents 73b9ae8 + 91ee9ef commit 4df8ad561c6959aa99cc22da6672a234b6b176c1 @haahmad haahmad committed Jul 16, 2012
View
@@ -1,14 +0,0 @@
-These two applications demonstrate how to invoke and handle invocations in BB10
-
-invoker:
- in config.xml: what to whitelist
- in invocations.js: how to send invocations
- using xhr level 2 to download binary image data
- HTML5 FileSystem API to save to the shared folder
- in index.html: how to use jQuery mobile to make applications touchscreen-friendly
-
-invokable:
- in config:xml: what to whitelist
- how to register an invocation target
- in index.html: How to handle invocations though blackberry.event
-
View
@@ -0,0 +1,46 @@
+# blackberry.invoke Sample Application
+
+Sample applications that demonstrate how to use the blackberry.invoke API for the Blackberry 10 WebWorks SDK
+
+**Tested On**
+
+* BlackBerry 10.0.6
+
+**Author(s)**
+
+* [Hasan Ahmad](https://github.com/haahmad)
+
+**Dependencies**
+
+1. [jquery.mobile-1.1.0.min.js, jquery.mobile-1.1.0.min.css, jquery-1.7.1.min.js ](http://www.jquerymobile.com/) The jQuery Mobile Framework
+
+
+**To contribute code to this repository you must be [signed up as an official contributor](http://blackberry.github.com/howToContribute.html).**
+
+## How to Build
+
+1. Clone the repo to your local machine
+2. Use Using the **[Ripple Mobile Emulator](http://developer.blackberry.com/html5/download)** and either the **[BlackBerry WebWorks SDK for Smartphone](http://developer.blackberry.com/html5/download)** or the **[BlackBerry WebWorks SDK for Tablet OS](http://developer.blackberry.com/html5/download)**, package the contents of your local **BB10-WebWorks-Samples/invoke/invoker** and **BB10-WebWorks-Samples/invoke/invokable** folders into a BlackBerry application.
+
+## Troubleshooting
+
+## More Info
+
+* [BlackBerry HTML5 WebWorks](https://bdsc.webapps.blackberry.com/html5/) - Downloads, Getting Started guides, samples, code signing keys.
+* [BlackBerry WebWorks Development Guides] (https://bdsc.webapps.blackberry.com/html5/documentation)
+* [BlackBerry WebWorks Community Forums](http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/bd-p/browser_dev)
+* [BlackBerry Open Source WebWorks Contributions Forums](http://supportforums.blackberry.com/t5/BlackBerry-WebWorks/bd-p/ww_con)
+
+## Contributing Changes
+
+Please see the [README](https://github.com/blackberry/BB10-WebWorks-Samples) of the WebWorks-Samples repository for instructions on how to add new Samples or make modifications to existing Samples.
+
+
+## Bug Reporting and Feature Requests
+
+If you find a bug in a Sample, or have an enhancement request, simply file an [Issue](https://github.com/blackberry/BB10-WebWorks-Samples/issues) for the Sample and send a message (via github messages) to the Sample Author(s) to let them know that you have filed an [Issue](https://github.com/blackberry/BB10-WebWorks-Samples/issues).
+
+
+## Disclaimer
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2010-2012 Research In Motion Limited.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
<widget xmlns=" http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0"
Binary file not shown.
@@ -1,4 +1,20 @@
<!DOCTYPE html>
+<!--
+* Copyright 2011 Research In Motion Limited.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
Binary file not shown.
Binary file not shown.
Deleted file not rendered
View
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2010-2012 Research In Motion Limited.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
<widget xmlns=" http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0.6"
Binary file not shown.
View
@@ -1,7 +1,23 @@
<!DOCTYPE html>
+<!--
+* Copyright 2012 Research In Motion Limited.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
<html>
<head>
- <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="webworks-1.0.0.7.js"></script>
<script src="invocations.js"></script>
<link rel="stylesheet" type="text/css" href="jquery/jquery.mobile-1.1.0.min.css" />
@@ -1,3 +1,20 @@
+/*
+* Copyright 2012 Research In Motion Limited.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
function onSuccess() {
document.getElementById("log").innerHTML += "<p>Invocation sucessful</p>";
}
@@ -55,21 +72,21 @@ function invokePictures() {
downloadPicture();
blackberry.invoke.invoke({
- uri: "file:///accounts/1000/shared/downloads/HTML5_Logo_512.png",
+ uri: "file:///accounts/1000/shared/downloads/rim_logo_black.jpg",
}, onSuccess, onError);
}
//Supported in HTML5: getting binary data from XHR request
function downloadPicture() {
var xhr = new XMLHttpRequest();
- xhr.open('GET', "/HTML5_Logo_512.png", true);
+ xhr.open('GET', "/rim_logo_black.jpg", true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
if (this.status == 200) {
var bb = new window.WebKitBlobBuilder();
bb.append(this.response);
- var blob = bb.getBlob('image/png');
+ var blob = bb.getBlob('image/jpeg');
saveFile(blob);
}
};
@@ -79,7 +96,7 @@ function downloadPicture() {
//This function demonstrates how to use the HTML5 FileSystem API: a .png blob is saved to a URI which is used for invocation
function saveFile (blob) {
function gotFs(fs) {
- fs.root.getFile("/accounts/1000/shared/downloads/HTML5_Logo_512.png", {create: true}, gotFile, errorHandler);
+ fs.root.getFile("/accounts/1000/shared/downloads/rim_logo_black.jpg", {create: true}, gotFile, errorHandler);
}
function gotFile(fileEntry) {
@@ -88,7 +105,7 @@ function saveFile (blob) {
function gotWriter(fileWriter) {
fileWriter.onerror = function (e) {
- alert("Failed to write PNG: " + e.toString());
+ alert("Failed to write JPEG: " + e.toString());
}
fileWriter.write(blob);
}
View
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 4df8ad5

Please sign in to comment.