I'm testing my app on a Galaxy Tab 2.
I have a button which looks like this in the code:
<button class='msdsBtn' onclick='launchGoogle();'>msds</button>
// test function
function launchGoogle(){
alertw("launch google");
intel.xdk.device.launchExternal("http://www.google.com");
}
// wrapper for xdk alert
function alertw(str){
intel.xdk.notification.alert(str);
}
the button doesn't do anything. No errors, no opening of Google, no alert box... nothing.
These buttons are dynamically created on the page.
Am I missing something? I should note that it all works in the emulator.
Do you have the proper plugin ("Notification", I believe, in this case) checked in your project settings?
I wouldn't spend too much time figuring out how to make this call work, as Intel is deprecating the XDK APIs that are redundant with Cordova APIs.
Instead, try switching out your notification calls with the equivelent Cordova method. It should look something like this:
navigator.notification.alert(message, alertCallback, [title], [buttonName])
And again, make sure you have the right plugin configured in your project settings ("Dialogs"). Your project settings can be accessed through the XDK IDE by clicking "Projects" in the upper left corner.
Here is the full documentation for the Cordova dialogs API:
https://github.com/apache/cordova-plugin-dialogs/blob/master/doc/index.md
EDIT: And as Ian says above, you can of course debug your app as it runs on a device through the Debug tab for Android, and with WEINRE on other platforms.
Related
app mode: chrome window without navigation panel(address+tab bars). Run this in terminal
google-chrome --app=http://stackoverflow.com/
I want to open a website in app mode directly from chrome. Is there an extension that adds such option? If not how do I write a small extension that does just that? I never wrote a chrome extension but I have some experience with html and javascript. Thanks
Edit: Main issue is chrome.windows.create has no "app" option for CreateType. I guess we can't do anything about it.
There is a way using chrome.management API.
chrome.management.generateAppForLink("http://stackoverflow.com/", "Stack Overflow", function(info) {
chrome.management.setLaunchType(info.id, "OPEN_AS_WINDOW", function() {
chrome.management.launchApp(info.id);
})
});
Note that the above code requires a user gesture (which is undocumented). For examples, see Invoking activeTab. Activating a context menu should be sufficient as a gesture.
However, this will create an app in the app launcher permanently. On the plus side, it will not create duplicates for the same URL/Title.
You can call chrome.management.uninstall(id), but it will require a confirmation from the user.
I have next code
function navigate(_hash){
alert('before');
//try#1
window.location.hash = _hash;
//try#2
// window.location.href=window.location.href.split("#")[0]+"#" +url;
alert('after');
}
navigate('someurl')
the issue is that after changing url hash (both variants) app just hangs. And interesting thing that second alert is not firing. so app just... crashes after some time.
Nothing in js console.
Debug log says
The thread 0x*** has exited with code 259 (0x103).
google found nothing on that. Seems like this is acommon error code.
More details:
i'm using ChaplinJs so just can't get away from hash navigation.
second thought was that chaplin overloads system and we caanot get anywhere, but(!) putting logs and alerts in source of lib in window.on('hashchange',....) also didn't make any effort because we do not get there also.
WP 8.0
tried both Cordova 4.* and 5.*
also tried to modify xhrXelper.cs but it is not related tonavigation itself.
PS: I know that jquery mobile suggests to disable hashchanges onmobile navigation. But i can't :(
PPS: also tried todisable chaplin haschanges
new App({routes: routes, controllerSuffix: '-controller', pushState: false,hashChange:true})
but this also didn't make any good results because it's placing hash to href to check it in interval and app hanged again. So i assume that is a webview problem
More additional info:
continious re-run of app makes it work sometimes (1 run of 10 can make it work). That's very strange.
Emulator and device behave in the same way.
Update: Read somewhere that it's critical to restrict navigting before "deviceready" event.
But this is also not a case.
Update2: create cordova proj from scratch. Added hash change indeviceready cb and it hangs
Update3: same code on 8.1 works perfect
I am trying to test cookie in device, so i build a simple application.
I have tested it on emulator and works fine.
but when i test it in apps testing server, and in device, All the Intel xdk function doesnt work (I just want test cookie),
I have put script <script>src="intelxdk.js"</script> in index.html.
But it doesnt work also, i have searched here,
intel-xdk html5 platform android aplication working properly in emulator but not working properly in device , so i include the <script src="xhr.js"></script> but it doesnt work also
My code is:
(Sorry, im just new here and cant post image if post under 10. Here the image)
http://helpmedong.esy.es/
The alert is still : Intel is not defined..
thx before..
ive found the problem.
I click "Project" button =>
then click +plugin tab =>
featured and custome cordova plugins =>
check the cache option.
Thx everyone.
And then put the coding in deviceready.
About my comment above and with cheyong help, I go to this way...
If you begin with project withou Cordova you click second option
But, in this way haven't plugins choice:
Than upgrade...
Note the option "plugins"
I developing an app for iOS and Android using PhoneGap 3.4.0 from the command line interface, and want to make use of the BarcodeScanner plugin. The problem is that the scanner does not actually do anything when called by my app. The camera does not come up. By using console.log with Safari developer tools, I can tell that the scan function does exist and is getting called... it just isn't doing anything.
I installed the scanner plugin like this:
phonegap plugin add https://github.com/wildabeast/BarcodeScanner
In the index.html, included the javascripts like this:
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
In config.xml, added this:
<gap:plugin name="com.phonegap.plugins.barcodescanner" />
When I set scanner variable like this it logs that there is a BarcodeScanner, and it does have a function scan, but then when I call the function scan nothing happens. (the camera does not open).
var scanner = cordova.plugins.barcodeScanner;
console.log(scanner) // => BarcodeScanner
This is how I'm calling the scan function:
scanner.scan( function (result) {
... my code here...
} );
Any ideas? I'd really appreciate any help or pointers in how to get the barcodeScanner to work with PhoneGap.
I´m having the exact same problem.
After I updated my App to support arm64 (iPad Air), I ran into this issue.
A work-a-round:
Push the hardware On/Off button.
Turn on the device again.
Try starting the barcodeScanner.
This worked for me - but the App will not leave my desk before the issue has been fixed properly.
The issue now exists on all of my devices (iPad Mini, iPhone 4S, iPad Air).
The problem was that the version from wildabeast was not compatible with PhoneGap >= 3.2.0.
Use this branch instead: https://github.com/phonegap-build/BarcodeScanner
Install with
phonegap local plugin add https://github.com/phonegap-build/BarcodeScanner
To get it to work, I had to create a brand new app, copy the www folder over, and then install the plugin.
I have an application that is using jquery, jquerymobile and spine.js running on phonegap (0.9.5.1) and have been having some issues getting it to work properly on iOS.
The application should be launching the camera when a div is tapped. In my controller I have it so that it does something similar to the following:
myController = Spine.Controller.create({
events: {"tap .take-picture": "takePic"},
takePic: function(){
var self = this;
navigator.camera.getPicture(function(data){
self.doStuffWith(data);
},
null,
{quality: 50, destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.PictureSourceType.CAMERA})
},
doStuffWith: function(data){
// Doing stuff with said data
}
});
What is really confusing me, is that this code works properly on Android. Are there some kind of iOS quirks that make it so that tap events aren't sent off properly?
I think that you are trying to use the Android phonegap js within the iPhone app. You need to make sure that you are including the right phonegap.js for the platform you are developing. Although they share the same name, each version of phonegap is tailored to its host OS.
This could be several things:
You are testing this in the iOS Simulator. There is no Camera in the Simulator, you don't have a fail callback specified, but there is a bug (I believe) in the API where it doesn't call the fail callback if the source type is not available anyway. You should see this ("Source Type Not Available") in the Run Log (Cmd-Shift-R).
On a device, I tested your code separately, and ran it in deviceReady(), it runs - so the API call seems to be correct. I added a touch handler to a button to call the code also, so it appears tap events are working. So based on these tests (on a device):
(a) the API call works
(b) tap events work
Which leads me to the conclusion that the bug is outside of those two possibilities.