How to fix screen orientation to default (either potrit or landscape) for my whole PhoneGap app - html

I have created an app using phonegap. I have installed that app in my mobile. Can anyone explain me to how to rotate my app screen based on the mobile position?
My Config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.mydomain.login_form" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>LoginForm</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="sample.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="market:*" />
<preference name="loglevel" value="DEBUG" />
<preference name="orientation" value="default" />
<plugin name="net.yoik.cordova.plugins.screenorientation" spec="1.3.1" source="pgb"></plugin>
<feature name="Whitelist">
<param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
<param name="onload" value="true" />
</feature>
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.geolocation.Geolocation" />
</feature>
<plugin name="Geolocation" value="org.apache.cordova.GeoBroker" />
<feature name="Compass">
<param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener" />
</feature>
</widget>
Thanks in advance.

You can set orientation preference into config.xml file
<preference name="orientation" value="default" />
<!-- all: default means both landscape and portrait are enabled -->
or
<preference name="orientation" value="portrait" />
or
<preference name="orientation" value="landscape" />
You can check other all config related settings here in this link

Related

Adding supported file type in windows phone 8.1

I have added four file type association in my package.appmanifest file
in which .pdf is one of them. Due to this when i am clicking on any
external pdf file, My app is also coming in the list along with Adobe
reader. What could be the reason.
Following is the code of my app.manifest file
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="195c0ec0-b933-4837-99c7-30250bbd0f9b" Publisher="CN=etu10" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="195c0ec0-b933-4837-99c7-30250bbd0f9b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>eBasta</DisplayName>
<PublisherDisplayName>etu10</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="eBasta.App">
<m3:VisualElements DisplayName="eBasta" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="eBasta" ForegroundText="light" BackgroundColor="transparent">
<m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png">
</m3:DefaultTile>
<m3:SplashScreen Image="Assets\SplashScreen.png" />
<m3:InitialRotationPreference>
<m3:Rotation Preference="portrait" />
<m3:Rotation Preference="landscape" />
<m3:Rotation Preference="landscapeFlipped" />
</m3:InitialRotationPreference>
</m3:VisualElements>
<Extensions>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name="text">
<DisplayName>text</DisplayName>
<SupportedFileTypes>
<FileType ContentType="text/xml">.xml</FileType>
<FileType ContentType="application/pdf">.pdf</FileType>
<FileType ContentType="application/zip">.zip</FileType>
<FileType ContentType="application/zip">.ebs</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name=".pdf">
<DisplayName>pdf</DisplayName>
<SupportedFileTypes>
<FileType ContentType="application/pdf">.pdf</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClientServer" />
<Capability Name="removableStorage" />
<Capability Name="picturesLibrary" />
<Capability Name="musicLibrary" />
<Capability Name="enterpriseAuthentication" />
<m3:Capability Name="contacts" />
<m3:Capability Name="appointments" />
<Capability Name="sharedUserCertificates" />
<Capability Name="videosLibrary" />
<DeviceCapability Name="location" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>
Well it's normal that your app is listed there as you supported that file extension. If you expected that your app opens the file alone, that's not possible in Windows phone as defining default file opener is not supported

How to enable title bar in Cordova Application?

Below is my code... I was not able to enable Title bar in my application.
How to enable that ?
config.xml
<widget id="com.example.hello" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" />
<feature name="Whitelist">
<param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
<param name="onload" value="true" />
</feature>
<allow-intent href="market:*" />
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
</widget>
I tried this..
<preference name="Fullscreen" value="false">
but its not working... Still the activity is displayed in fullscreen mode... How to disable that fullscreen and show title bar ?
Add these two lines in config file
preference name="fullscreen" value="false"
preference name="showtitle" value="true"

Phonegap Permission for camera

I cannot get my app properly working I target android but I use a config.xml to build my app in phonegap. What do I need to add here to make my app show camera permission when installing my app?
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.sample.com" version = "1.0.0" versionCode = "1" >`enter code here`
<name>sample</name>
<description>sample</description>
<author>sample</author>
<gap:platforms>
<gap:platform name="ios" />
<gap:platform name="android" />
<gap:platform name="webos" />
<gap:platform name="symbian.wrt" />
<gap:platform name="blackberry" project="widgets"/>
</gap:platforms>
<icon src="icon.png" />
<preference name="phonegap-version" value="3.6.3" />
<feature id="blackberry.media.camera" />
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />
<access origin="*" subdomains="true" />
<access uri="*" subdomains="true" />
<access uri="http://redasmobile.esy.es/" subdomains="true" />
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.InAppBrowser" />
</feature>
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="false" />
<preference name="target-device" value="universal" />
<feature name="Camera">
<param name="blackberry-package" value="org.apache.cordova.camera.Camera" />
</feature>
</widget>
Add those lines to your config.xml
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" /><!-- WRITE_EXTERNAL_STORAGE; required for camera to write to camera roll -->
Do you use the cli command ie cordova build android or do you use build.phonegap.com ?
If you use the client, you have to do a : cordova plugin add org.apache.cordova.camera
If you use build phonegap you have to add
<gap:plugin name="org.apache.cordova.camera" version="0.2.4" />
in your config.xml

Server control width won't apply with IE11 ?

I have this simple server control with a valid Width attribute : ( asp.net 4 , vs2010 )
<asp:TextBox runat="server" ID="TXT_UserName" Width="250px"></asp:TextBox>
On all browsers (all + ie<11) it does render as it should with the appropriate Width
But with ie11 ( windows 8.1 ) it wont render as it should : (it's even not in the view source ) :
Here is how I see it in other browsers ( including ie<11)
I've already added (for past problems which are now solved) the App_Browsers folder with the appropriate files for compatibility with IE versions :
Question :
Why I'm not seeing the width attribute and how can I fix it ?
Hmm...can't reproduce your error, and I don't have any special App_Browser folder, though I'm on VS2012 (4.5):
<asp:TextBox ID="styletextbox1" runat="server" Width="250px"></asp:TextBox>
Render Source (ie11):
<input name="ctl00$MainContent$styletextbox1" type="text" id="MainContent_styletextbox1" style="width:250px;" />
Dev tools (ie11):
So our diff are:
VS2012
4.5
App_Browser
Hth...
I had the same issue and fixed.
Your App_Browsers folder should contain:
firefox.browser, ie.browser, and ie11.browser
The ie11.browser content:
<browsers>
<browser id="IE11" parentID="Mozilla">
<identification>
<userAgent match="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)" />
<userAgent nonMatch="IEMobile" />
</identification>
<capture>
<userAgent match="Trident/(?'layoutVersion'\d+)" />
</capture>
<capabilities>
<capability name="browser" value="IE" />
<capability name="layoutEngine" value="Trident" />
<capability name="layoutEngineVersion" value="${layoutVersion}" />
<capability name="extra" value="${extra}" />
<capability name="isColor" value="true" />
<capability name="letters" value="${letters}" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="screenBitDepth" value="8" />
<capability name="type" value="IE${major}" />
<capability name="version" value="${version}" />
</capabilities>
</browser>
<!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
<browser id="IE110" parentID="IE11">
<identification>
<capability name="majorversion" match="11" />
</identification>
<capabilities>
<capability name="ecmascriptversion" value="3.0" />
<capability name="jscriptversion" value="5.6" />
<capability name="javascript" value="true" />
<capability name="javascriptversion" value="1.5" />
<capability name="msdomversion" value="${majorversion}.${minorversion}" />
<capability name="w3cdomversion" value="1.0" />
<capability name="ExchangeOmaSupported" value="true" />
<capability name="activexcontrols" value="true" />
<capability name="backgroundsounds" value="true" />
<capability name="cookies" value="true" />
<capability name="frames" value="true" />
<capability name="javaapplets" value="true" />
<capability name="supportsCallback" value="true" />
<capability name="supportsFileUpload" value="true" />
<capability name="supportsMultilineTextBoxDisplay" value="true" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
<capability name="supportsVCard" value="true" />
<capability name="supportsXmlHttp" value="true" />
<capability name="tables" value="true" />
<capability name="supportsAccessKeyAttribute" value="true" />
<capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
<capability name="vbscript" value="true" />
</capabilities>
</browser>
</browsers>

Update app.config from WIX setup?

I am trying Wix 3.6 and this is how it looks right now :
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="myappINSTALLDIR" Name="myapp5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="myapp5.WindowsService.exe" Name="myapp5.WindowsService.exe" Source="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe" KeyPath='yes'/>
...
<ServiceInstall Id="InstallmyappService" DisplayName="myappService" Name="myapp5.WindowsService.exe" Description="myapp 5 Service - För effektivare och enklare operationsplanering" Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlmyappService" Name="myapp5.WindowsService.exe" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</Directory>
</Directory>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
Now I need to add a dialog to the Wix setup where one appSetting and one baseadress(WCF) is set to the app.config. This most be done before the installation becouse it will decide the name of the Windows Service that the Wix is installning.
And exampel would be great!
Edit 1:
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe.config"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/ServiceName"
Name="baseAddress" Value="[SERVICEADDRESS]" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
You could add in a reference to the WixUtilExtension.dll to the installer project, then use XmlFile to update the app.config like:
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="[DirApplication]$(var.app.config)"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/...."
Name="baseAddress" Value="[SERVICEADDRESS]" />
Note that you'll need to set the directory and the name of the .config file (you could just use $(var.ProjectName.TargetFileName).config which should work it out for you automatically