I am running into an issue where when I open my app in Testflight, the splash screen hides and then there is just a white screen before the app loads.
I have this in my app.js:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
setTimeout(function() {
navigator.splashscreen.hide();
}, 3000);
});
})
And this in config file:
<preference name="SplashScreen" value="splash"/>
<preference name="AutoHideSplashScreen" value="true"/>
<preference name="SplashScreenDelay" value="4000"/>
<preference name="FadeSplashScreen" value="true"/>
<preference name="FadeSplashScreenDuration" value="1"/>
The splash screen hides normally when I run my app through the emulator, its just when I run it in Testflight that it breaks. Neither the config nor app.js seem to have any effect on how long the splash screen shows on Testflight.
If anyone has any advice I'd really appreciate it, thanks!
my splashscreen configuration is as below and it works fine without any issue
nothing i added in app.js
i added this plugin to my ionic project.
I copied my res/ folder into my project root folder which has all splashscreen drawable- files in respective folders inside
in config.xml
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<preference name="SplashMaintainAspectRatio" value="true|false" />
<platform name="android">
//then added all dpi as this
<splash src="res/drawable-land-hdpi/screen.png" density="land-ldpi"/>
</platform>
Related
I am trying to trigger the cordova camera plugin from inside reactjs. In previous iterations It was utilizing a simple HTML5 file input.
Upon further research I discovered that that the current webview that cordova uses for android platforms does not provide an option for camera control (thus the native cordova plugin).
I am trying to trigger the cordova camera plugin from inside reactjs after being built with:
npm run build
then the contents of the app's build directory are coppied to cordovas 'www' directory.
The Cordova app is relatively vanilla and camera plugin added with the command.
cordova plugin add cordova-plugin-camera
Here is the config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</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" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<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:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.2" />
<engine name="android" spec="^7.1.4" />
</widget>
The React Component is as follows
import React, { Component } from "react";
import { Alert } from "reactstrap";
import "../../Containers/containers.css";
import { connect } from "react-redux";
import userTools from "../../Services/userTools";
class Avatar extends Component {
constructor() {
super();
this.state = {
avatar: "https://denisol.se/wp-content/uploads/2018/05/empty-avatar.jpg"
};
}
takepicture() {
if (!window.cordova) {
var Camera;
//Unless theres another way to suppress webpack
//During Build
}
navigator.camera.getPicture(
file => this.readFiles(file),
err => console.log(err),
{
quality: 50,
destinationType: Camera.DestinationType.FILE_URI
}
);
}
readFiles(file) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.addEventListener(
"load",
() => {
console.log(reader.result);
this.setState({
avatar: reader.result
});
},
false
);
}
render() {
var avatarurl;
if (this.props.myinfo && this.props.myinfo.avatar.avatar.url) {
avatarurl = this.props.myinfo.avatar.url;
} else {
avatarurl =
"https://denisol.se/wp-content/uploads/2018/05/empty-avatar.jpg";
}
if (this.props.new) {
avatarurl = this.state.avatar;
}
return (
<div>
<img
id="avatar"
alt="test"
src={avatarurl}
onClick={() => {
if (this.props.updatable || this.props.new) {
this.takepicture();
//As for normal html input you would do the following
this.refs.fileUploader.click();
}
}}
/>
<input
type="file"
name="avatar"
ref="fileUploader"
style={{ display: "none" }}
accept="image/*;capture=camera"
capture
onChange={e => {
if (e.target.files.length && this.props.updatable) {
userTools.updateAvatar(e.target.files[0]);
} else if (e.target.files.length && this.props.new) {
this.readFiles(e.target.files[0]);
this.props.newAvatar(e.target.files[0]);
}
}}
/>
</div>
);
}
}
function mapStateToProps(state) {
return { myinfo: state.myinfoReducer };
}
export default connect(mapStateToProps)(Avatar);
when i execute the function there seems to be no response from cordova (permissions request, camera opening, ect...). Note that this component is only part of a larger react project where everything else is working more or less as expected.
Any Help is greatly appreciated thanks.
i made this sample repo to study the problem and it seems to be recovering the image correctly.
By doing this and reading the event handling docs, a possible cause could be the lack of bind() on handlers since this is a class component.
Please see the repo and i really rope it helps.
I was able to get the camera functionality working by migrating my react project over to browserify. Not the simplest solution but will work for the time being thanks for that tip.
This question already has an answer here:
WPF-Log4Net used inside VSIX extension did not output log when installed at target VS
(1 answer)
Closed 4 years ago.
I have a WPF solution. I downloaded log4net dll, I added log4net.config and had set the "Copy to Output Directory" value as "Copy always".
log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="myapp.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
</configuration>
And I added the below line in AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
then the below code in my TestWindowControl.xaml.cs
public partial class TestWindowControl : UserControl
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public TestWindowControl()
{
XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
log.Info("info testing");
log.Debug("debug testing");
log.Error("error testing");
log.Fatal("fatal testing");
log.Warn("warn testing");
}
}
But logs are not writing to the file. It's working in Console application but not working for WPF. Am I missing something?
Try to set the filter inside appender
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
<levelMax value="ERROR" />
</filter>
I added the splashscreen plugin using this:
cordova plugin add cordova-plugin-splashscreen
I have images for the icon and splashscreen and added them to the resources folder and have added this code in my controller.js:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
setTimeout(function() {
navigator.splashscreen.hide();
}, 300);
});
})
And I added the following in my config.xml:
<preference name="ShowSplashScreen" value="true" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="false" />
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
And also this:
<platform name="android">
<icon src="resources/android/icon/icon.png" />
<splash src="resources/android/splash/screen.png" />
</platform>
But after building my app (using adobe's online phonegap builder) the icon shows, but the app starts with a blank white screen for a few seconds instead of the splashscreen. What could be the problem?
Add the plugin with :
$ ionic plugin add org.apache.cordova.splashscreen
$ ionic platform add android
$ ionic build android
$ ionic run android
Once the image is created, you have to include it in your project by adding the following to config.xml:
<splash src="pathtosplashimage" />
Example Configuration
In the top-level config.xml file (not the one in platforms), add configuration elements like those specified here.
Please notice that the value of the "src" attribute is relative to the project root directory and not to the www directory (see Directory structure below). You can name the source image whatever you like. The internal name in the app is determined by Cordova.
Directory structure:
projectRoot
hooks
platforms
plugins
www
css
img
js
res
screen
android
ios
windows
<platform name="android">
<!-- you can use any density that exists in the Android project -->
<splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
<splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
<splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
<splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>
<splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
<splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
<splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
<splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>
<platform name="ios">
<!-- There are two mechanisms for showing launch images.
-- Legacy method (supports all devices except iPad Pro 12.9):
-- Note: Images are determined by width and height. The following are supported -->
<splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
<splash src="res/screen/ios/Default#2x~iphone.png" width="640" height="960"/>
<splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="res/screen/ios/Default-Portrait#2x~ipad.png" width="1536" height="2048"/>
<splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="res/screen/ios/Default-Landscape#2x~ipad.png" width="2048" height="1536"/>
<splash src="res/screen/ios/Default-568h#2x~iphone.png" width="640" height="1136"/>
<splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
<splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
<splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
<!-- Storyboard method (supports all devices):
-- Important: If you use the storyboard method, legacy images are
-- copied but ignored.
-- Note: images are determined by scale, idiom, and size traits. The following
-- are suggested based on current device form factors -->
<splash src="res/screen/ios/Default#2x~universal~anyany.png" />
<splash src="res/screen/ios/Default#2x~universal~comany.png" />
<splash src="res/screen/ios/Default#2x~universal~comcom.png" />
<splash src="res/screen/ios/Default#3x~universal~anyany.png" />
<splash src="res/screen/ios/Default#3x~universal~anycom.png" />
<splash src="res/screen/ios/Default#3x~universal~comany.png" />
</platform>
<preference name="SplashScreenDelay" value="10000" />
More information can be found on https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
My dnn mvc module is missing the Edit option. Normally you will get the pencil icon for editing see pic below
I'm using Chris Hammond template for this MVC module that I'm working on.
This is my Module.dnn file look like
<moduleControls>
<moduleControl>
<controlKey />
<controlSrc>Abc.Controllers/Home/Index.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle />
<controlType>View</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>
<moduleControl>
<controlKey>Edit</controlKey>
<controlSrc>Abc.Controllers/Home/Edit.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>Edit Content</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
<supportsPopUps>False</supportsPopUps>
</moduleControl>
<moduleControl>
<controlKey>Settings</controlKey>
<controlSrc>Abc.Controllers/Settings/Settings.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>FishProNews Settings</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>
</moduleControls>
</moduleDefinition>
I have a Home Controller that point to Index and Edit but since I'm missing the Edit (pencil icon) I'm not able to test the Edit function.
Does anyone know hot to get the Edit (pencil icon) option?
Jack,
The Edit icon is not a missing option. The pencil opens the ModuleAction menu that must be implemented by the module developer. Chris Hammond's template should have a decorator on your default module view's (Home) Index action.
[ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")]
public ActionResult Index()
{
// Return the view and model
}
The ModuleAction decorator will add an item to the "pencil" module action menu. The ControlKey refers to the name of the action you want to call in your manifest file; ie: "Edit" which should have a Edit.cshtml and Edit action method in your Home controller. The TitleKey is the resource string for the menu. In your App_LocalResources/Home.resx you can add a resource string "AddItem.Text" with the value "Add New Item", for example.
You should see something like this:
To see a working example, refer to my RestaurantMenuMVC example project.
Here is a commun error, but every solution give on Stack didn't solve my problem.
I have a phonegap app, my jsonp call send me a 404 error
Here is the function of the controller (angularjs) :
$scope.pullContent = function() {
$http.jsonp($scope.yourAPI+'/?page='+$scope.pageNumber+'&callback=JSON_CALLBACK').error(function(jqXHR, textStatus, errorThrown){
alert("### ERROR ###");
alert(textStatus +' // '+ errorThrown);
alert($scope.yourAPI+'?page='+$scope.pageNumber);
}).success(function(response) {
if($scope.pageNumber > response.pages){
// hide the more news button
$('#moreButton').fadeOut('fast');
} else {
$scope.items = $scope.items.concat(response.posts);
window.localStorage.setObject('rootsPosts', $scope.items); // we save the posts in localStorage
window.localStorage.setItem('rootsDate', new Date());
window.localStorage.setItem("rootsLastPage", $scope.currentPage);
window.localStorage.setItem("rootsTotalPages", response.pages);
// For dev purposes you can remove the comment for the line below to check on the console the size of your JSON in local Storage
// for(var x in localStorage)console.log(x+"="+((localStorage[x].length * 2)/1024/1024).toFixed(2)+" MB");
$scope.totalPages = response.pages;
$scope.isFetching = false;
if($scope.pageNumber == response.pages){
// hide the more news button
$('#moreButton').fadeOut('fast');
}
}
});
}
Here is my config.xml :
<content src="index.html" />
<access origin="*" />
<feature name="http://api.phonegap.com/1.0/network"/>
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="DisallowOverscroll" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="android-installLocation" value="auto" />
<icon gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/android-icon-36x36.png"/>
<icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/android-icon-48x48.png"/>
<icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/android-icon-72x72.png"/>
<icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/android-icon-96x96.png"/>
<gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="www/res/screen/android/small.png"/>
<gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="www/res/screen/android/medium.png"/>
<gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="www/res/screen/android/large.png"/>
<gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="www/res/screen/android/xhdpi.png"/>
here is the result of "phonegap plugin list" :
cordova-plugin-whitelist 1.2.2 "Whitelist"
org.apache.cordova.inappbrowser 0.5.4 "InAppBrowser"
org.apache.cordova.network-information 0.2.14 "Network Information"
Can anybody have a solution for me ?
Add this config setting to your config.xml which should resolve the issue:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />