Call c# function from javascript in Xamarin.Forms Webview - xamarin

I want to make call of some c# code when user tap on a button in html. I followed below example and also tried it and it is working for my purpose if i use it as it is.
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview
It uses index.html from assets, instead i want to use some URL where my html page is. But unfortunately when i change url, it stops invoking c# code.
Please let me know if there are any changes needed to get it working.

It was some firewall settings blocking communication from my iOS simulator, got it fix after adding certificate.
Example demo is working fine now

Related

How to wait for the angular universal to fully charge?

My application works perfectly without angular universal . I display an image before the complete loading of my application(https://medium.com/#tomastrajan/how-to-style-angular-application-loading-with-angular-cli-like-a-boss-cdd4f5358554) but it does not work in anular Universal. It displays nothing. When rendering angular universal the breakpoint hits come too late and i want to avoid that
Angular Universal's entire point is that it will render on the server and not in the browser. So the article you linked in terms of having a loading image while Angular bootstraps won't happen with Universal as it's already "bootstrapped" on the server before it's given to you in the browser.
Another way to think about it is that you can use a loading gif OR use Angular Universal to achieve a similar result of not giving a user a blank screen.
In terms of the second part of your question with breakpoints not being hit. Again this is a quirk with Angular Universal in that because the first page request is rendered on the server, if you are attempting to debug something in the browser it's not going to work as you might first think because the rendering has already happened server side. To debug Angular Universal you need to debug both in browser, and using something like VS Code to debug as a regular NodeJS app. If that sounds like a headache it's because it is. Unless you have a really good reason to use Universal, I wouldn't recommend using it just because you can.
More info :
https://angular.io/guide/universal
https://tutorialsforangular.com/2020/04/04/3-things-they-dont-tell-you-about-angular-universal/

Xamarin.forms make phone call without going to dialer in Android

In my Xamarin.forms app, I can call a specified phone number using Xamarin.Essential plugin. The problem I am facing is, when I click to call on my app in Android it will open the phone dialer and the user should manually click call.
In iOS, it will directly place a call without going to the dialer. What my intention is to prevent editing of the number in the dialer.
So, How can I call the number without going into dialer instead it should show calling screen directly in android? I have seen many posts, but I didn't get any ideas. Any help is appreciated.
I am making a call using xamarin.Essential plugin like this
PhoneDialer.Open(PhoneNumber.Text);
To place a phone call directly, you can use Xam.Plugins.Messaging library:
After installing the nuget, add this line in Android project MainActivity's OnCreate method:
CrossMessaging.Current.Settings().Phone.AutoDial = true;
Now you can place any call directly like below:
var phoneDialer = CrossMessaging.Current.PhoneDialer;
if (phoneDialer.CanMakePhoneCall)
phoneDialer.MakePhoneCall("+27219333000");
Please note using this settings requires the
android.permission.CALL_PHONE added to the manifest file.

Is it possible to prevent your app from appearing as an extension for specific apps?

I've built an Action Extension for my app, and when i choose to Open In... something from inside of my app, I appear as an extension for myself. This UX is kinda weird, but also, it doesnt even work when i try to be an extension of myself.
I dont see anything in the documentation that specifies responding apps aside from NSExtensionActivationRule?
This is not possible at the moment in iOS 8.0

Open URL from HTML5 xcode app

I initially started doing this app with Dreamweaver and phonegap build. After running into some issue I bypassed Phonegap build and imported my project directly into xcode (my first time using).
The problem I am having is when someone clicks the url it opens up in the app instead of the browser. I am very new to apps in general and a baby when it comes to xcode so forgive me if this is pretty cut and dry.
My anchor looks like this:
<a data-role="button" href="http://www.google.com/" target="_blank" style="color:#07a54a;">
Like I said when someone clicks that, its like it opens within the app and there is no way to get back to the app unless you kill it.
Specifically my questions is how do I get this url to open outside the app in the phones browser? I have watched and read numerous tutorials talking about .h and .m files, but all of these seem to be using the drag and drop story board which I dont have or know how to use.
Can someone tell me how I can have this (and other absolute url's) open in the browser outside of the application?
Thanks
There's no such thing as an "HTML5 Xcode app". You say you bypassed PhoneGap and imported it directly, but that's not possible. Xcode doesn't know what to do with plain HTML 5. It sounds like you are still using PhoneGap, in which case you follow whatever the normal PhoneGap procedure for opening links in Safari is.
Found it: Thanks http://docs.phonegap.com/en/2.3.0/cordova_inappbrowser_inappbrowser.md.html
Poorly worded on my end, app uses phonegap :D

How can I render HTML in a Silverlight 5 app?

I'm currently working on a project that renders emails in HTML format to a Silverlight 5 app. The app is intended to be viewed via a web browser and not an 'Out of browser' app. The WebBrowser control was initially used, but I'm having issues with it. A message stating that IE needs elevated permissions and such. After reading how to properly implement the WebBrowser control by signing the .xap file and installing certificates it seems to work when I run it locally, but when I publish to the server (Windows Server 2008), it doesn't seem to work.
I tried to implement an alternative I found -> http://blogs.msdn.com/b/delay/archive/2007/09/10/bringing-a-bit-of-html-to-silverlight-htmltextblock-makes-rich-text-display-easy.aspx, but that didn't seem to work as the HTML I'm trying to render has many tags not supported in that example.
I also took a look at the Frame control http://msdn.microsoft.com/en-us/library/system.windows.controls.frame(v=vs.95).aspx but not sure if that would solve my problem either.
So if anyone can guide me into the right direction of either how I can get the WebBrowser control to work when pushed to the server or perhaps another alternative it would be greatly appreciated.

Resources