Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

App Preview

Alex3
Beginner
1,855 Views

I do not understand what happens with App Preview, the issue is that do not show the same result as Emulator, when I invoke a command like intel.xdk... do not work and the app is stopped this happens with IOS App Preview and Android App Preview but in Emulator everything works fine... here is the code.

HTML

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <link rel="stylesheet" href="css/app.css" />
    <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css" />
    
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

    <script src="intelxdk.js"></script>
    <script src="cordova.js"></script> 
    <script src="xhr.js"></script>
    <script src="js/app.js"></script>

Jscript

var rest_url = 'http://www.biipitdev.com/';
var device_id = null; 
var iPhoneFlag = false;

var windowHeight;
var init = function () {
    windowHeight=window.innerHeight;
    if( navigator.userAgent.match(/iPhone|iPod/) ){
        iPhoneFlag = true;
    }
};

window.addEventListener("load", init, false);  

/**
 * Prevent Default Scrolling 
 */
var preventDefaultScroll = function(event) 
{
    // Prevent scrolling on this element
    event.preventDefault();
    window.scroll(0,0);
    return false;
};

$( document ).bind( 'mobileinit', function(){
  $.mobile.loader.prototype.options.text = "loading";
  $.mobile.loader.prototype.options.textVisible = false;
  $.mobile.loader.prototype.options.theme = "a";
  $.mobile.loader.prototype.options.html = "";
});
   
window.document.addEventListener("touchmove", preventDefaultScroll, false);

var onDeviceReady = function() { 

    //alert('device ready');
    //get a unique device_id
    device_id = device.uuid;  intel.xdk.notification.alert(device_id);

    //hide splash screen
    if( window.Cordova && navigator.splashscreen ) {     // Cordova API detected
        intel.xdk.device.hideSplashScreen(); 
    }

    //set orientation
    intel.xdk.device.setRotateOrientation("portrait");
    intel.xdk.device.setAutoRotate(true);

    //manage power
    intel.xdk.device.managePower(true,false);

};
//onDeviceReady();
document.addEventListener("deviceready", onDeviceReady, false) ; 

0 Kudos
15 Replies
Barry_Johnson
New Contributor I
1,855 Views

By "do no work" do you mean you get an error? What error?

You could wait for the "intel.xdk.device.ready" event, which at least for me, always fires after Cordova's deviceReady.

0 Kudos
Alex3
Beginner
1,854 Views

Look now I have another issue... 

I changed the order of the scripts call in index.html and now works, but the problem now is when I invoke the camera comes a black screen with a cancel button at bottom only.

 

0 Kudos
Barry_Johnson
New Contributor I
1,854 Views

You really need to work on providing more useful information to people if you want help. Are you getting a black screen on a device or in the emulator? What device? How are you invoking the camera, etc, etc, etc, etc, etc, etc

0 Kudos
Alex3
Beginner
1,855 Views

I am getting a black screen in device (Iphone and Samsung), in emulator works fine.

0 Kudos
Barry_Johnson
New Contributor I
1,854 Views

How are you invoking the camera?

0 Kudos
Alex3
Beginner
1,855 Views

    document.addEventListener("intel.xdk.device.barcode.scan", barcodeScanned, false);
    intel.xdk.device.scanBarcode();

 

0 Kudos
Barry_Johnson
New Contributor I
1,855 Views

OK - wow, so your question was about the camera but the reader is supposed to guess the barcode scanner. I have to grab a sandwich, but I'll throw this in an app in about 30 minutes to see what happens.

In the interim- It is worth noting that in this thread - found by searching "barcode" on this forum-  John H from Intel suggests checking if a third party plugin works. Note that since the app preview cannot use "non-standard" plugins you could only test this with a built app.

https://software.intel.com/en-us/forums/topic/542638

0 Kudos
Alex3
Beginner
1,855 Views

But I develop a similar app the last year and intel.xdk.device.barcode.scan works fine, the problem is after updated the app preview for IOS 8.x

0 Kudos
Alex3
Beginner
1,855 Views

Look

http://prntscr.com/6icmvj

In Emulator works but in App Preview I only gets a black screen.

0 Kudos
Barry_Johnson
New Contributor I
1,855 Views

That information would also have been useful. 

In any case, I used the sample app code from https://software.intel.com/en-us/node/493036 

Works fine in Android App preview at least for on-device debugging using Crosswalk. I did not do USB cable for iOS since I avoid the mac as much as I can. But it does not work on App Preview via Wifi with iOS 8.2. I too get the black screen with cancel button.

Not certain it is the source of the troubles, but my experience is that Apple often breaks stuff with their camera - was an issue with a native app I dealt with last year as well. You might be best finding a third party plugin whose author is willing to keep up with Apple's changes.Since September of last year,  Apple have released iOS 8.0, a week later 8.01, a day later 8.0.2, then of course we had 8.1,  8.1.1 ,8.1.2, 8.1.3 and now 8.2.

Best of luck with it, in any case.

0 Kudos
Alex3
Beginner
1,855 Views

Yes is the same example that I took and make a modification for my App, but is weird because before works perfectly and now doesn't work, like you said the problem is with the version of IOS... let me research in Apple Forums about.

Thank You.

0 Kudos
Alex3
Beginner
1,855 Views

By the way I added a third party Cordova Barcode Scanner to my project and now I gets Can not read property barcodescanner.. at the end I am still stuck in the same point.

0 Kudos
Barry_Johnson
New Contributor I
1,855 Views

Don't forget that the third party plugin will only work in build apps - you can't test them using AppPreview. I recognize the challenge in supporting this, but in my opinion every minute of effort put into the AppDesigner GUI builder would be better spent implementing a feature like that. Frankly, Intel could probably make a nice packet if they just added that as "premium" offering on the free XDK. I am not sure what i would pay for it, but I am pretty certain more than they would dare to charge for a personal developer license.

0 Kudos
PaulF_IntelCorp
Employee
1,855 Views

We're working on an on-device debug solution that would allow debugging with third-party apps. Company policy does not allow me to say when that feature will be available, but we are working hard on solving that problem and recognize it's value.

@Barrett -- I'll forward your comment regarding App Designer to our project manager.

0 Kudos
Barry_Johnson
New Contributor I
1,855 Views

Thanks Paul. I appreciate, and probably not even fully, the complexity of implementing it, and also think that it's the sort of feature that anyone doing this commercially, even if as a sideline, would be willing to pay at least something for given the massive time savings it would offer. Your on-device debugging facilities are a real timesaver even within the 3rd party plugin restriction. The only things I am thinking about extra plug-ins for are a couple of bells & whistles so I am saving rolling those in until near the end.

0 Kudos
Reply