Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

thread warnings in Phonegap/Cordova app

I am getting these two thread warnings compiling on an iPhone (iOS 6):

THREAD WARNING: ['InAppBrowser'] took '260.519043' ms. Plugin should use a background thread.
THREAD WARNING: ['Geolocation'] took '110.953857' ms. Plugin should use a background thread.

this is how I call the plugins in my code:

window.open("http://www.anaddress.com", '_system');

and this is how my config.xml looks like:

<?xml version='1.0' encoding='utf-8'?>
<widget id="my.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Hello Cordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <access origin="*" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value=".25" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="KeyboardShrinksView" value="false" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="ShowSplashScreenSpinner" value="true" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>
    <author email="[email protected]" href="http://www.example.com">Me
    </author>
    <content src="index.html" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
</widget>

Of course I installed the plugins using the cordova CLI:

$ cordova plugin add org.apache.cordova.inappbrowser

Any help would be appreciated, Thanks!

like image 484
Pompeyo Avatar asked Dec 04 '13 08:12

Pompeyo


1 Answers

Look at the Phonegap Documentation and search for "Threading" They explain that you might want to run the thread in the Background instead of the main one.

Apple doesn't like Blocked UI so you need to find a way to cancel your call if it takes more than 10 milliseconds.

Although you are not getting errors, just warnings.

like image 67
Bruno Avatar answered Nov 15 '22 19:11

Bruno