Can't hide Intel XDK splash screen - android

I have created a small game and created build using Intel XDK. I installed it in device and can see the splash screen. I tried what is mentioned in other topics but unable to remove the splash screen.
function onDeviceReady(){
if( navigator.splashscreen && navigator.splashscreen.hide ) {
navigator.splashscreen.hide();
}
if( window.intel && intel.xdk && intel.xdk.device ) {
if( intel.xdk.device.hideSplashScreen ) {
intel.xdk.device.hideSplashScreen();
}
intel.xdk.device.setRotateOrientation("landscape");
intel.xdk.device.setAutoRotate(false);
intel.xdk.device.hideStatusBar();
}
}
document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);
This is how it looks initially when I launch the app.
I have this plugin added in the project
cordova-plugin-splashscreen
Please help me resolve this issue.

Received this answer on XDK forum
The purpose of the splashscreen is to hide the details of the
initialization process (even before your device ready fires). The
splashscreen you see is the default cordova splash screen, you can
replace it by your own graphics. You can upload custom splashscreen
through Launch Icons and Splash screens on Projects page. The
hidesplashscreen() method will hide the splashscreen that is displayed
at the initialization and the contents of your app will appear (which
happens when device is ready).

Related

Ionic app is “restarted” when I move it to background

Im creating an app and I need to keep working in background but this doesnt work.
Im using:
https://github.com/katzer/cordova-plugin-background-mode
I am on Visual studio with ionic , so I execute:
ionic cordova run android
The app is launched and working. The first view is a Login, I fill the login and this take me to the second view (thit is a tab page).
On this page I add:
import { BackgroundMode } from '#ionic-native/background-mode/ngx';
constructor(private background: BackgroundMode){
this.background.enable();
console.log(this.background.isEnable());
console.log(this.background.isActive());
this.background.moveToBackground();
}
Also, console.log shows that is enable, but not active (that is normal).
The problem is that when I move the app to the background, is “restarted” . I mean that when I open the app from the background it takes me again to the first view where I should do the Login. So this is not working.
This image appears all the times that I open the app for background, and after this, the app is restarted
Am I doing something wrong? Is visual studio?** How can I solve it?**
Thanks!
Use plugin Background Mode
ionic cordova plugin add cordova-plugin-background-mode
npm install #ionic-native/background-mode
Then use it like this:
import { BackgroundMode } from '#ionic-native/background-mode/ngx';
export class AppComponent {
constructor(private backgroundMode: BackgroundMode) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.backgroundMode.enable();
});
}
}

$ionic.Platform.ready not firing in android

I currently have the $ionicPlatform event listener in my app.js. I know it's working in the test environment on the pc browser, but when I build the app and run it on my android device, the ionicPlatform.ready never actually runs/fires. Any ideas?
Here are some threads/questions posted, with some solutions that haven't worked for me.
https://github.com/driftyco/ionic/issues/1751
https://stackoverflow.com/questions/32421291/code-inside-ionic-platform-ready-not-getting-fired-up
app.js
var app = angular.module('who', ['ionic', 'ngCordova'])
.run(function($ionicPlatform, $rootScope, $cordovaDevice) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
var push = new Ionic.Push({
"debug": true
});
push.register(function(token) {
console.log("Device token:",token.token);
});
console.log('reached end of ionic platform ready');
});
})
UPDATE 12/14/2015 # 5:24 AM - I have a view/activity that loads first, it renders the results from the $ionic.platform.ready listener. Upon loading the app, it renders nothing. What's interesting is this, after going to another view/activity, and then going back to the first view/activity, the result is then loaded/rendered. Any ideas?
UPDATE 12/14/2015 # 5:30 AM - I have tried ionic.Platform.ready, I have tried the document.addEventlistener 'deviceready'. None of them are working, and $ionicPlatform.ready gives me the least amount of problems, so I have defaulted to that.
I've decided to go with this workaround for now, unless someone can refactor this better for me.
The data retrieved in the $ionicPlatform.ready would not be rendered in the first activity loaded. I would usually have to navigate to at least 1 more activity and then go back to see the results. Now I know ionicFramework has it's own default splash activity that I don't want to override for this purpose (for now), so I added another view/state/activity that just serves as a buffer and immediately navigates to the results activity.
app loaded <- the ionic platform ready should be fired here, but it doesn't
ionic splash activity
buffer activity
result activity <- ionic platform ready finally fires up, weird.
Could just be my misunderstanding of Ionic's data synchronization, but this dirty fix seems to have solved it.

mobile change page transisition reverse options not working android 5+ version using cordova application

I am newbie in cordova. I am trying to develop a mobile application which need to support for all platform.
I am facing a problem while trying to change the two pages in transition reverse mode.
In below android version 4.4.2 and ios platform developed app is working fine. But in above android 5.0 version and windows platform it showing blank page like below image.
Its happening when the user hitting the back button from mobile. jquery function for transition reversing which is mentioned below.
$.mobile.changePage("#mainpage" , { transition: "slide" ,reverse="true"} );
If I removed the argument reverse=true for above android 5.0 version, the transition reverse mode working fine with below function.
$.mobile.changePage("#mainpage" , { transition: "slide" } );
I am using jquery1.3.0 version, cordova5.1.1.
Is there is any way to fix the issue for different android version and other platform.
Please let me know.
Use the following method to do so.. it will work on device's back key down, and if you want to add button on UI for back, then you can call onBackKeyDown() on click event of that button
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
console.log('Device ready - register onBackKeyDown()');
}
document.addEventListener("deviceready", onDeviceReady, false);
function onBackKeyDown() {
try{
var nav = window.navigator;
if( this.phonegapNavigationEnabled && nav && nav.app && nav.app.backHistory )
{
nav.app.backHistory();
}
else
{
window.history.back();
}
}
catch(e)
{
alert(e);
}
}

splash screen not working on Samsung galaxy android 4.1.1

I am facing one typical issue where our application(built with cordova 3.4.0) working for all versions from 2.3.x to 4.4.x however on following device because of splash screen plugin the app is not able to load
Samsung Android SGH-1747M
Version 4.1.1
When we remove splash plugin it works fine.
Issue : We have a splash screen open for 30 seconds before we redirect user to our login page (load from server side)
If we add splash plugin it doesn't load the login page it shows half black and half white screen forever, but if i remove splash screen plugin it works.For all other versions app working fine with splash screen plugin.
Thanks in advance for your help.
Since its 4.1.1 i am not able to get stack trace or logging statements on aLogcat , but below is the onCreate method that we have
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (appView == null) {
init();
}
appView.setWebChromeClient(new CordovaChromeClient(this, appView));
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
appView.getSettings().setAllowFileAccess(true);
super.loadUrl(getString(R.string.app_url), 30000);
}
and using the same cordova pluing for splash screen as standard one (cordova version 3.4.0)
<preference
name="SplashScreen"
value="splash"/>

Phonegap window.open does not work on Android

I have an iOS/Android app built on cordova 2.6 and jqm 1.3. I need to open a link to an external website after the user clicks on a button. The code I am using is:
var ref = window.open('http://google.com','_self','location=yes');
ref.addEventListener('loadstart',function(event) {
console.log('load started');
});
ref.addEventListener('loadstop',function(event) {
console.log('load stopped');
});
ref.addEventListener('loaderror',function(event) {
console.log('load error = ' + JSON.stringify(event));
});
On iOS everything performs like I would expect. A new browser window opens with the google website loaded. But I cannot get anything to to load in Android. When I click on the button, nothing happens. I have put in console statements before and after the window.open, so I know the code is at least being executed.
My config.xml should be wide open for white listed sites:
<access origin=".*"/>;
I have tested on a Nexus 7 (android 4.2) and an android 2.2 emulator with the same results on both.
Does anyone know why window.open would not be firing correctly on android?
It looked like it was a problem with 2.6 loading plugins on Android. I upgraded to 2.7 and everything started to work.
Perhaps it's a solution to use the ChildBrowser plugin? This gives you a bit more control over the operation itself, while still preserving platform compatibility between iOS and Android.
In most cases, I use something like the following snippet to use the childbrowser to display an external page.
function openBrowser(url) {
// determine if the childbrowser plugin is available
var useChildBrowser = ('plugins' in window && window.plugins.childBrowser);
if (useChildBrowser) {
popup = window.plugins.childBrowser;
popup.showWebPage(url, { showLocationBar: false, showAddress: false });
} else {
popup = window.open(url, 'Share', "['width=600px', 'height=400px', 'resizable=0', 'fullscreen=yes']");
}
}
Note that this falls back to using window.open if the ChildBrowser plugin isn't available, so you won't break anything else with this. Could be worth a shot, perhaps?

Categories

Resources