Winjs not working in multi-device hybrid app - winjs

I 'm using WinJS in multi-device-hybrid app template in one of my page .But the code is not working fine (below is code).
HTML
<a id="facebook">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALIAAAAgCAYAAAC2JCIgAAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/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9rskdQx3PfIrOl2mhyxkZ0MhEd3KHI3ylM5TBPGTpMQVdHWeNo9NRCJLG7VJl0XOawzqkANohzf4pwOxqZdgKEe02BG+6aSfp1BWCcBRC6YbkaSGA7Dvi4PVUW5nLf1VsGe45EXnesdTOFaxVp2+owRFYGLvJxyGrkfgXb3O3RyypIbgAw93NftWsP215wAcjvN22lQbMB4GexAQ19Jy8Ww/Qb4MUDqMMResi2h12ooa/5ZJt+9nv6///HJFGs3WfqhARziCfIWnvfx5jxGvrqVKyG/kfI6cjmnMf9j7QicuUj5vBR5fuUMQOnzQRcfpN7vnwGOkvGMWaS0vn4u4EUZHAY2+fgBO4Qlzv33aWTv7fnNuzcN+4D5sCVe+3+3wEAkUTd9qA5Y08AAAAASUVORK5CYII=" />
</a>
Javascript-
ready: function (element, options) {
// TODO: Initialize the page here.
document.getElementById("facebook").onclick = function () {
if (checkconnection())
document.getElementById("facebook").href = "https://www.facebook.com/amit.porwal.14";
else
Windows.UI.Popups.MessageDialog("Check your Network Connection").showAsync();
}
function checkconnection() {
var connectivity = Windows.Networking.Connectivity;
var profile = connectivity.NetworkInformation.getInternetConnectionProfile();
if (profile) {
return true;
}
else
return false;
}
when i 'm not using checkconnection() function the app is working fine with navigation to the facebook website.
So is there any restriction on using winjs in multi-device-hybrid template .
I 'm debuging this on android device.
With that i 'm also using
Wins.xhr ,<x-ms-webview>
in my app but none of them is working .

Any API's that begin with Windows.* is a WinRT API and are not part of WinJS. WinJS APIs always start with WinJS.; the Windows. APIs work only on Windows/Windows Phone 8/8.1 and won't work on Android.
WinJS.xhr is just a simple wrapper for XMLHttpRequest, so should work on any system with the DOM API available. You typed Wins.xhr, however, so maybe you just have a typo.
As for , that also is an HTML element specific to the Windows app host, and isn't part of the standard DOM. If you're targeting Android you'll need to use its HTML Webview equivalent.

Related

how to first launch my website popup

I have a problem where I want to make my website when you first accessed through a mobile phone message to download the app or website.
What is needed? Can anyone help me solve my problem?
Javascript for example:
You can set a cookie.
<script>
var tehDiv = document.getElemenbyId('adiv');
if (localStorage.getItem('firstTime'){
theDiv.innerHTML='';
}else{
localStorage.setItem('firstTime', 'no');
theDiv.innerHTML='The html that shows download app buttons';
}
</script>
<body>
blablablabla
<div id="adiv">Here will be placed download buttons or not</div>
If need to know if is a mobile there are many scripts to that. For example this one: Detecting iOS / Android Operating system

Is it possible to get the currently playing track in the 1.x apps api?

I am trying to update my Spotify remote control app that is currently using the legacy API to use the new 1.x API. Is it possible using the 1.x API to access information about the currently playing track? models.player.track does not seem to exist anymore (though it's in the documentation).
For the curious, I am using this for my app running in Spotify Desktop which uses websockets to talk with a Python server, which then provides a web interface for phones and tablets to remotely control the instance of Spotify running on the desktop. This works great using the legacy API and I can control playback and get the now playing info from any connected remote. I assume this app is going to stop working at some point soon since Spotify says they are retiring the legacy API. (Unless my assumption that the app will stop working is wrong, then never mind).
Thanks.
It is possible to access the current playing track loading the track property of the Player.
You would do something like this:
require(['$api/models'], function(models) {
function printStatus(track) {
if (track === null) {
console.log('No track currently playing');
} else {
console.log('Now playing: ' + track.name);
}
}
// update on load
models.player.load('track').done(function(p) {
printStatus(p.track);
});
// update on change
models.player.addEventListener('change', function(p) {
printStatus(p.data.track);
});
});
You have a working example in the Tutorial App named Get the currently playing track.

How do I load phonegap/cordova with jade?

I am developing a Web Application using node.js, express and jade. I have the following jade template which I am seeing using a WebView in a Phonegap application:
doctype mobile
html
head
script(src="cordova-2.1.0.js")
script
var ready = function() {
alert(\'Ready\');
}
document.addEventListener("deviceready", ready);
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
h1= title
button(id='vibrateButton', onclick='navigator.notification.vibrate(2000);')Confirm
#services
- each service in services
div.service
a(href=service.link)!= service.name
div.desc= service.description
What this template will produce is a webpage with a list of items (a description and a link) which will be fetched from a mongo database. The page is served using node.js
Now, the cordova script is not loading because the alert ("Ready") is not being displayed. Also, if I hit the button the device won't vibrate and the console will display the following message:
Uncaught TypeError: Cannot call method 'vibrate' of undefined at http://xx.xxx.xx.x:3000/:5
How can I include the Phonegap script using jade? I have tried to load simple scripts with just an alert and it works, but in this case I don't know why it is not working.
Could anyone provide advise please? Thanks.
With recent changes to cordova, you should take a look into InAppBrowser api. That's the recommended way to deal with remote pages embedded in your application.
In the end, you'll probably have a single index.html on the application to make sure the cordova js api is loaded and everything is ok. Then you'll open an InAppBrowser targeting your remote page (remember to whitelist it on config.xml for a better experience!).
The dot after the script is missing. Read this:
"Often you might want large blocks of text within a tag. A good
example is with inline scripts or styles. To do this, just add a .
after the tag (with no preceding space)"
It's taken from the jade-lang reference.
Example:
script.
if (usingJade)
console.log('you are awesome')
else
console.log('use jade')
Will render:
<script>
if (usingJade)
console.log('you are awesome')
else
console.log('use jade')
</script>
these will never work.
the html pages needs to be on the client side( app side ) not in the server side(node).
Example. In a android phonegap proyect on the assets\www folder.
i dont know for wat SO is your app, but
App client side: views, phonegap, jquery .... and all the stuff to request the data to the node server.
Server side: dbStuff, and all the stuff to retrieve the data to the app requests.
hope it helps.

Passing URL of the active tab to my site handler

I suspect this is a total newbie question, but I seem to be missing the basics here. I am NOT new to coding and have a lifetime of experience (27 years) with various languages, but the plugin process is eluding me.
I have developed custom bookmarking system in php & js, it works great and I've been using it for months as I develop it.
I simply want to get the url of the page in the active tab and pass it to my php handler. I want my web site script return the html form into the popup. I can think of a thousand ways that "should" work.
ALL the code examples I am finding seem to over-complicate what should be a simple task.
In short I just want:
<script type="text/javascript">
<!--
var loadurl = "http://my.site.com?theUrl=" + window.location;
location.href = loadurl;
//-->
</script>
And have that page show in the popup. So far I'm at a loss. Even tried ajax calls etc.
Can somebody clue me in on how to achieve this simple task? Maybe I can get started writing extensions with the info.
For the record, most of the examples I have found are deprecated under manifest 2.0
Manifest 2.0 introduces a new feature contentSecurityPolicy. All external resources are blocked by default. For the best practice, you should include all needed asset files in the extension. The communication between your extension and your service (php side) is only data using XHR2.
So, In order to make bookmark extension work, I guess you need to something like this:
Add your service's domain to permissions array
{
...
permissions: ['*://my.site.com/*', 'tabs']
}
Move all javascript from popup.html to popup.js. In popup.js, You create a ajax request to your bookmarking service. More document here
function addBookmark(url) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://my.site.com/new_bookmark.php?url=" + encodeURIComponent(url), true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
var resp = xhr.responseText;
// handle service result here
}
}
xhr.send();
}
chrome.tabs.getSelected(null,function(tab) {
addBookmark(tab.url);
});

jQuery Mobile and Google Maps API v3 memory leak

I have a mobile web app using jQuery Mobile 1 and Google Maps API v3. It appears there is a major memory leak when loading Google Maps inside jQuery Mobile. The memory taken by the Google Maps does not get released when the user leaves the map page. So, when the user returns to the map page the memory usage keep growing. This is especially a big issue on mobile web browsers. I test the following on Android and on a desktop version of Chrome. The leak can be triggered as follows:
Navigate to: http://www.mycoursewalk.com/mobile_course_walk/show/25
Click "View Course" and let the map load fully.
Then click the browser back button or the back button on the lower left corner.
Reclick "View Course" and let the map load fully.
Repeat. On every map load you see about 30MB added to the process of Chrome or the mobile browser.
How can I fix this? I can't find a Map API unload.
Thanks,
Nick,
I think you are calling createMap every time instead of checking whether or not the map already exists and re-using the object.
Try something like this:
var mapDisplay = {
mapCreated : false,
init: function() {
//some init stuff
},
showMap: function() {
if(!mapDisplay.mapCreated) {
mapDisplay._createMap();
mapDisplay.mapCreated = true;
}
$("#my_map").show();
$('#my_map').gmap('refresh');
},
_createMap : function() {
//options would be a json config object
$('#my_map').gmap(options);
},
//all the other methods you need
}
which would work with the libraries used in this jQuery gmap demo application

Resources