Ionic printer plugin not working on ios for external link - ionic-framework

I am trying to print external link into ionic app using ionic printer plugin
https://ionicframework.com/docs/native/printer/
printticket(){
let printurl = "http://www.gmail.com";
let options: PrintOptions = {
name: 'Waridi Events',
duplex: true,
landscape: false,
grayscale: false
};
this.printer.print(printurl, options).then(onSuccess=>{
console.log("Done =>" + onSuccess);
}, onError=>{
console.log("Error=>"+onError);
});
}
This is working on android but not working on ios. Please give me some better way to print.
sometimes it is working
And sometimes failed to load data

Finally I got the solution using api call.
Before call the print call the api from the link and get the html codes and save all into a variable and print it.

Related

Ionic PDFMake throws error when swtiching between pages after PDF generation

I am using PDFMake, library to generate PDF from my ionic/angular application. The PDF generation is working perfectly fine. However issue is that -
After pdf generation process is completed, I go back to dashboard page
And from dashboard page I go to Another page (any page, same pdf generation page or any other page), I get following error.
I have following codes:
import pdfMake from 'pdfmake/build/pdfmake';
import pdfFonts from 'pdfmake/build/vfs_fonts';
pdfMake.vfs = pdfFonts.pdfMake.vfs;
//---------------------
//---------------------
ionViewWillLeave(){
if(this.pdfObj) this.pdfObj = null;
}
generatePdf(){
let docDefinition = {
pageSize: "A3",
content: [
..............
],
}
this.pdfObj = pdfMake.createPdf(docDefinition);
this.pdfObj.download();
}
------------------------------------
Any help will be highly appreciated.
Thanks
This issue is due to pdfmake.js polyfills all promises related function and due to this all ionic promises are redirecting to those polyfiled functions
currently I'm also facing same issue for iOS devices only so I have added workaround as follows which may help you as well (Not sure with exact solution)
ionic 5
cordova 10
pdfmake 0.2.4

Problem with Webview showing Google Photos in Flutter

I am using flutter_webview_plugin: ^0.3.11
This is my code
Widget build(BuildContext context){
return WebviewScaffold(
url: glbPhotoURL,
withJavascript: true,
scrollBar : true,
withZoom: true
)
url: glbPhotoURL => here glbPhotoURL is a URL that I am passing
When I am using any normal URL it is running fine (like http://www.google.com, http://youtube.com"
Even url like - https://youtu.be/o5UPfG1eIw4 is running fine
But when I am using any google photo url (short url) it is throwing an error net::ERR_UNKNOWN_URL_SCHEME for eg - https://photos.app.goo.gl/FkQenAD8kQQc4TSr6
If I am using the expanded URL it shows the pictures -https://photos.google.com/share/AF1QipNItZG3Cg_hn9__2QnuVh3nNMbRuGxQaQSWZ76qni7L7h0ORbauolcH3AKe0MOnEA?
key=emc1Mk1CenRJRjloMjV5V1AzcmczNUprcGFsbmR3
Please help me resolve the issue
As of now I am running it on Android physical device.
Google Photos uses Firebase Dynamic Links. I suggest launching the link externally. I encountered a similar error on Android before, when Firebase Dynamic Links are being forced to be loaded in a WebView. FDLs are expected to be handled by Google Play Services in Android. But since the WebView doesn't know what to do with the link it's forced to display, the WebView returns "net::ERR_UNKNOWN_URL_SCHEME" error.
Open the link externally by using url_launcher. Use RegEx to filter intent URLs and check if the URL can be launched and be handled externally (outside the app).
var yourURL = "URL goes here";
// Check if URL contains Google Photos URL
yourURL.contains(RegExp('^https://photos\.app\.goo\.gl/.*$')){
// Check if the URL can be launched
if (await canLaunch(yourURL)) {
await launch(yourURL);
} else {
print('Could not launch $yourURL');
}
}

Parse Configuration in Android with Smartface App Studio

I am trying to config Parse plug-in into my android app with Smartface App Studio. I followed the link http://www.smartface.io/developer/guides/advanced/push-notification-on-parse-services/#before450 with Smartface App Studio 4.5 version.
But, the device is not getting registered with parse and even not getting any fail message.
Can any one help on this. Thanks in advance.
You are using Smartface 450, so the document you should check is this one below:
http://www.smartface.io/developer/guides/advanced/push-notification-on-parse-services/#after450
You can use the below code on Global.Smartface.js in order to see if it registered or not:
alert("Registration is successful : \n" + Parse.getToken("Landroid/app/Activity;"));
And in Page1.onShow, you can use parse methods as below:
Parse.onRegistrationFail = function () {
alert("Parse Registration failed");
};
// if the application is open and receives notification
Parse.onParsePushReceive = function () {
alert("app opened : \n\n" + Parse.getData());
};
//if the application is closed and get opened by a parse notification
if (Parse.openedByParseNotification()) {
alert("app opened by a notification : \n\n" + Parse.getData());
}

Getting error unsupported_response_type

I am working on login with google functionality with $cordovaOauth.google plugin. But I am getting unsupported_response_type error.
$cordovaOauth.google("MY_APP_ID", ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"]).then(function (result) {
console.log(JSON.stringify(result));
alert(JSON.stringify(result));
$scope.gdata = result;
}, function (error) {
console.log(error);
});
Where I am making mistake !?
Yes because $cordovaOauth plugin loading webview so you must need web clientID from Google API. And that will not work for ionic ( Mobile app ) so you need to do following things.
First
You need to use schema for your app to give internal URL like google:// or twitter://
Reference : http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/
and provide that custom URL in Google redirect url ( This is not working all time as Google not accept custom URL but you can give it a try ).
Second and Working solution :
You need to create Google app with your app identifier and keytool.
For Android :
https://developers.google.com/identity/sign-in/android/start follow step second and provide your app name and unique identifier ( i.e dipesh.cool.com )
For iOS : 
https://developers.google.com/mobile/add?platform=ios&cntapi=signin
same information as mentioned for android.
Then you need to get REVERSED_CLIENT_ID value from the config file which download will be available once you are done with above two steps ( you can grab it from iOS config file it is easy to find from that file ).
And then simply run below command and code and you will have all working.
Command :
cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=GRAB_THIS_FROM_IOS_OR_ANDROID_CONFIG_FILE
Angular code :
$scope.GoogleLogin = function()
{
$scope.loaderShow('Google');
window.plugins.googleplus.login({},function (obj)
{
window.localStorage.setItem('signin', 'Google');
window.localStorage.setItem('g_uid', obj.userId);
window.localStorage.setItem('g_fname', obj.givenName);
window.localStorage.setItem('g_lname', obj.familyName);
window.localStorage.setItem('user_full_name', obj.displayName);
window.localStorage.setItem('g_email', obj.email);
window.localStorage.setItem('gotPdetails', 'false');
$scope.loaderHide();
$state.go('app.dashboard');
},
function (msg)
{
$scope.showAlert('Google signin Error<br/>'+msg);
$scope.loaderHide();
});
}

Processing incoming APP link Titanium Studio Iphone

I'm using Titanium's facebook module to show a apprequests dialog. I could send application request and when I get into the facebook app and hit the notification, I could get into my app.
But, how do I process the incoming URL? I went through the link Deep link with requests
that shows how to do it with Objective C. Any help on how to implement it with Titanium Studio would be appreciated. Thanks.
You can get the arguments with this snippet :
var cmd = Ti.App.getArguments();
if ( (getTypeOf(cmd) == 'object') && cmd.hasOwnProperty('url') ) {
Ti.App.launchURL = cmd.url;
Ti.API.info( 'Launched with url = ' + Ti.App.launchURL );
}
this is called the URLScheme, if you are looking for online docs!
Source: http://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android