PhotoViewer plugin only shows black screen or crashes on iOS - ionic-framework

I'm using Ionic 4 (4.12.0) with the PhotoViewer plugin versions:
"#ionic-native/photo-viewer": "^5.21.5",
"com-sarriaroman-photoviewer": "^1.2.4",
And the code is:
public presentImage(imgSrc): void {
this.photoViewer.show(imgSrc, '', {
share: false,
closeButton: true,
copyToReference: true
});
}
The variable imgSrc is a base64. If I remove the options, the photoViewer opens with a black screen, but with the options it's crashing the app. But as the title states, it only happens on iOS.

after read the document, base64 is just supported on android. So it is what the problem.
(1.1.4) Base64 Support on Android

Related

Badge counter on launcher icon in flutter

I am trying to implement badger count on app launcher icon in flutter for all android based devices. I've tried flutter_app_badger and flutter_dynamic_icon as well but both of them aren't compatible with android. I wan't a unamious solution it's awesome if it works both for android or ios as well.
I am trying to find solutions but there isn't enough data present. Onesignal push notification I am using for the app provides default badge count but it's not in all devices either.
Please help me with the situation.
setLauncherNumber()async{
// set batch number
try {
print('LauncherBadge inside try');
// FlutterAppBadger.updateBadgeCount(10);
await FlutterDynamicIcon.setApplicationIconBadgeNumber(93);
print('LauncherBadge Success');
} catch (e) {
print('LauncherBadge error $e');
}
}
flutter_app_badger and flutter_dynamic_icon arent compatible with all devices
Use this package flutter_app_badger: ^1.5.0
import 'package:flutter_app_badger/flutter_app_badger.dart';
FlutterAppBadger.updateBadgeCount(1);

Different behaviour of url_launcher plugin on Android and iOS

I am using the plugin url_launcher in my Flutter app. It is working fine, but it works different on Android and on iOS devices.
The used URL proposes the download of a PDF file on Android and shows the PDF on iOS.
This is the code:
_launchURL(String codigo) async {
String url = 'https://...pdftest.php?cod='+codigo;
if (await canLaunch(url)) {
await launch(url,forceWebView: true, enableJavaScript: true,enableDomStorage: true);
} else {
throw 'Could not launch $url';
}
}
Here you have the output on iOS:
On Android, the output without the parameters
forceWebView: true, enableJavaScript: true,enableDomStorage: true
the output is as follows:
Is there a way to force the PDF show on Android? Or should I download the file and then open it from the device?
You can open PDF in Google Docs Viewer to make both behave the same
http://docs.google.com/gview?embedded=true&url=<URL>

Change Color of Notification Bar According to Nav Bar Color in ionic 1 Application

I'm developing Android application using Ionic 1 Framework.
On using the app on mobile the color of notification bar is not changing it remains default.
Is there any specific setting or plugin that we need to use, to change color of notification bar in accordance with Nav bar color ?
With the plugin "cordova-plugin-statusbar", (https://github.com/apache/cordova-plugin-statusbar) I've done it like this :
if (window.StatusBar) {
if (ionic.Platform.isAndroid()) {
StatusBar.backgroundColorByHexString('#0288D1');
} else {
StatusBar.styleLightContent();
}
}
but if you want to link it with your nav-bar, you should use ionic color variables, like "assertive", as in this link : http://ionicframework.com/docs/components/#colors
You can read the docs at the two URLs I gave you for more informations.
Install the plugin
cordova-plugin-statusbar 2.1.3 "StatusBar"
Then inside your app.run and $ionicPlatform.ready add the following code. that is
app.run(function($ionicPlatform,$cordovaStatusbar){
$ionicPlatform.ready(function() {
if(window.StatusBar) {
$cordovaStatusbar.overlaysWebView(false)
$cordovaStatusbar.styleHex('#E52225'); //change color
}
})
})
For more details about the plugin visit
https://github.com/apache/cordova-plugin-statusbar

Status Bar in iOS 8 using Cordova issue

In the iOS cordova app which i am currently developing the status bar is initially hidden.
Within the app i am accessing Camera and Device Gallery in order to get the images.
for Device Gallery
navigator.camera.getPicture(
successCB,
failCB,
{
quality : 50,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
destinationType : Camera.DestinationType.DATA_URL,
correctOrientation : true
});
Whenever i access the device photo gallery plugin, the status bar is visible on top of my app.
Tried using Cordova Status Bar Plugin, used the below code for hiding the status Bar.
StatusBar.hide();
Its doesnt seems to be working.
iOS SDK : 8.1
Any help is highly appreciated.
thanks
the issue is with the success callback of cordova camera plugin.
the below code was not getting executed properly.
StatusBar.hide();
So tried using setTimeout which did the trick as shown below.
setTimeout(function(){ StatusBar.hide();}, 0);
Please refer Cordova Camera plugin iOS Quirks

iOS on resume not working

I need a view in my app to refresh everytime the app comes back to the foreground. The code below is working perfectly with Android but nothing happens on iOS.
$ionicPlatform.on('resume', function() {
if($state.current.name == "app.listar_aprovacoes"){
// code to refresh scope and view.
};
});
I also tried the following and it also doesn't work with iOS:
document.addEventListener("resume", function() {
var alertPopup = $ionicPopup.alert({
title: 'Foo',
template: 'Bar'
});
}, false);
So could you help me out with a solution to this problem?
Thanks!
EDIT: For some reason, updating the platform using ionic platform update ios didn't update the code for this. I removed the platform and added it again and it started working.
Try using window.addEventListener('resume', callback); as well.
Also make sure you have the Cordova Device Plugin.
You can install it by using:
ionic plugin add cordova-plugin-device
Generally, with the plugin installed, the first ($ionicPlatform.on('resume', ...)) method should work. I tested both on iOS and Android.
For some reason, updating the platform using ionic platform update ios didn't update the code for this. I removed the platform and added it again and it started working.