- Template: app
- Created ABP Studio Version: 0.8.2
- Tiered: No
- UI Framework: maui-blazor
- Theme: leptonx
- Theme Style: system
- Database Provider: ef
- Database Management System: sqlserver
- Separate Tenant Schema: No
- Mobile Framework: maui
- Public Website: No
- Optional Modules:
- GDPR
- FileManagement
- TextTemplateManagement
- LanguageManagement
- AuditLogging
- SaaS
- OpenIddictAdmin
Steps to reproduce the issue: We're using the default MAU Blazor (Hybrid) template as created via ABP Studio, and have added the "Login workaround" code as provided here [Maui Blazor (Hybrid) App Can't Login #7908](https://abp.io/support/questions/7908/Maui-Blazor-Hybrid-App-Can%27t-Login)
The solution name is Handheld When the "Server" project Handheld.HttpApi.Host is running and the mobile app Handheld.MauiBlazor is deployed and running on an Android emulator, all works as expected, however when the "Server" project is not running (to simulate the mobile device not having connectivity to the server), the mobile app Handheld.MauiBlazor does not start and throws the above exception in MauiProgram.cs
The reason we're testing this is that the mobile application needs to be able to work when it has no Internet Connectivity as it will be used to take photos as part of vehicle inspections, some of which take place at airfields or ports where Internet connectivity is not always available.
While we realise that none of the "Server" functionality would be accessible via the APIs in the Handheld.HttpApi.Host, we were hoping to be able to test for Network Connectivity using the normal MAUI libraries e.g. Connectivity and switch functionality on/off as appropriate.
The client project (Handheld.MauiBlazor) that is deployed to the mobile device though, appears to perform a lot of calls to the server as part of its "startup code".
Q. As a mobile app that won't start unless it has full internet connectivity is not going to be practicable for us, how might we utilise the ABP Studio MAUI (Blazor Hybrid) template / libraries to achieve this?
13 Answer(s)
-
0
Hi,
You told you are working on Android. Did you forward your local machine port to the emulator by following Port mapping step from the documentation?
https://abp.io/docs/latest/framework/ui/maui?Tiered=No#android
As an example:
adb reverse tcp:44305 tcp:44305
44305 should be your HttpApi.Host port
-
0
Hi,
Yes we did the adb step, which in our case is
adb reverse tcp:44358 tcp:44358
I didn't write down each specific step as in our previous question Login question in order to keep the question clear, but it is the same Solution.
I mentioned that we have liangshiwei's workaround code in place in case it is relevant, but the startup behaviour is the same without that workaround code in place.
With the server project (Handheld.HttpApi.Host) running we have a functioning app and we can even Login due to the workaround code.
When the server project is running......... If we put a breakpoint on line 36 (see screenshot in the question) and then execute that line, we see the following in the console output window of the server (Handheld.HttpApi.Host) project
The red outlined section is what happens as line 36 is executed, with the yellow section appearing to show calls to the server e.g.
[INF] Request finished HTTP/1.1 GET https://localhost:44358/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0 - 200 null application/json; charset=utf-8 75.7252ms 2024-09-26 10:56:15.896 +01:00 [INF] Request starting HTTP/1.1 GET https://localhost:44358/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0 - null null
which is why we suspect that when the deployed mobile project (Handheld.MauiBlazor) cannot contact the server (as might be the case for a mobile application), these calls fail and the application cannot startup?
-
0
Unless things have changed very recently, we can confirm seeing the same problem, app would not run without the backend available. In our case, that was not a problem so we never bothered to investigate it further. This is true also with the app deployed to my Android with the backend i Azure stopped.
-
0
Thank you for the confirmation.
While we understand that the abp libraries both open source and commercial should be platform agnostic and shouldn't have to care about high level issues like connectivity, it seems like unfortunately, the "disconnected scenario" has not been considered for the overall ABP Maui Blazor Hybrid project template?
Which leaves us in a tricky situation as we seemingly can't use ABP to create the mobile client of our Application?
Q. Could we please get a view from the ABP Architect/Designers whether that is the actual current situation and whether/if the ABP templates are likely to deal with the disconnected scenario in the near future?
If that isn't likely to happen in the very near future or not at all, then we still have a project to start which leaves us with the option of using the Microsoft projects templates i.e. for the mobile part, and getting some use out of the ABP Product by utilising the ABP server side parts.
Q. Presumably we could call all the existing ABP endpoints that we see via Swagger on the Handheld.HttpApi.Host project and get some use from the ABP libraries?
We're not sure if that means removing these parts from the Solution
or... Q. whether it would be cleaner to just create an ABP Blazor Server App so we'd still have our GUI for administering Users, setting up Tenants, viewing Audit Logs etc. and call into the nnnnHttpApi.Host via the Swagger endpoints from a Visual Studio generated ".NET MAUI Blazor Hybrid and Web App" which would startup in the disconnected state and we could also detect when we have connectivity and call our server side logic through the abp/api endpoints when required?
-
0
Honestly, not due to ABP but we have given up on MAUI for now even tough we are .NET people. Would really like to use it though if/once it becomes ready for prime time including tooling that does not break as soon as you try to install Firebase packages etc. The dream to finally get rid of JS continues to be a dream but one day :)
But that is probably another discussion, but that is the main reason we did not continue trying to get it to work properly with ABP. I hope you manage to get it sorted for your needs.
-
0
Honestly, not due to ABP but we have given up on MAUI for now even tough we are .NET people. Would really like to use it though if/once it becomes ready for prime time including tooling that does not break as soon as you try to install Firebase packages etc. The dream to finally get rid of JS continues to be a dream but one day :)
But that is probably another discussion, but that is the main reason we did not continue trying to get it to work properly with ABP. I hope you manage to get it sorted for your needs.
Thanks for the heads up, we've had great success with Blazor Server and the ABP libraries that utilise that architecture, with the rapid development due to not having to duplicate all dto's in C# and javascript and the magic SignalR connection between server and browser, but our mobile journey is just beginning.
We seem to have hit a very large brick wall at the moment, and we really want to utilise HTML, CSS and razor pages rather than .XAML......but we shall have to see how this all ends up!
-
0
Honestly, not due to ABP but we have given up on MAUI for now even tough we are .NET people. Would really like to use it though if/once it becomes ready for prime time including tooling that does not break as soon as you try to install Firebase packages etc. The dream to finally get rid of JS continues to be a dream but one day :)
But that is probably another discussion, but that is the main reason we did not continue trying to get it to work properly with ABP. I hope you manage to get it sorted for your needs.
Thanks for the heads up, we've had great success with Blazor Server and the ABP libraries that utilise that architecture, with the rapid development due to not having to duplicate all dto's in C# and javascript and the magic SignalR connection between server and browser, but our mobile journey is just beginning.
We seem to have hit a very large brick wall at the moment, and we really want to utilise HTML, CSS and razor pages rather than .XAML......but we shall have to see how this all ends up!
Xamarin Forms AFAIK is EOF now so it's all MAUI. Don't think that neither ABP nor Blazor is the main problem here for the time being. Would be really nice to be able to reuse Blazor though all the way.
-
0
... Xamarin Forms AFAIK is EOF now so it's all MAUI. Don't think that neither ABP nor Blazor is the main problem here for the time being. Would be really nice to be able to reuse Blazor though all the way.
We agree, .Net MAUI has replaced Xamarin.
We're interested in the MAUI Blazor Hybrid model (which our understanding is that its a Blazor webview control running natively inside a mobile device under .Net MAUI) because it lets us utilise our decades of HTML, .css etc. knowledge rather than having to use .XAML which came in with Silverlight / WPF IIRC, and we can still access the mobile hardware such as the camera etc. while developing in C#
Our immediate roadblock is that its looking like the ABP template was not designed to work in the scenario where the mobile device does not have 100% connectivity!
We'll have to see what the ABP architects/designers say re my questions to decide what direction / solution we end up with!
-
0
Can we have a response from ABP Support Team please?
Thank you.
-
0
@enisn A disappointing lack of support from ABP..............
Let me ask the question in a more concise way based upon what we have deduced the past week while we've been waiting for a reply............
We've concluded the ABP .Net Maui Blazor Hybrid template will not work if the mobile device does not enjoy 100% connectivity at all times, which is unrealistic for a mobile device.
What we really need is the following
i.e. a Blazor Server App, with .Net Maui Hybrid project(s) forming the Mobile Framework part.
That will give us a server application with all the usual menus for Administering users/config, viewing Audit Logs etc. and a mobile part that can be deployed to devices.
We're trying to construct this ourselves i.e.
where the highlighted projects were created by the Visual Studio template
Q. with regard to authentication, can we just call the Swagger Login endpoint on the server to authenticate, or do we need to do anything else?
-
0
Q. with regard to authentication, can we just call the Swagger Login endpoint on the server to authenticate, or do we need to do anything else?
You can use the same way with MauiBlazor template. It has pre-configured login-flow by using
Volo.Abp.Account.Pro.Public.MauiBlazor
package. You can check usage of by creating a MauiBlazor template and implement to your case.Alternatively, you can implement OAUTH login from scratch by using WebAuthenticator
-
0
Edit: ...........
We have found the source for
Volo.Abp.Account.Pro.Public.MauiBlazor
within the Pro Account module.Q. Are saying we can somehow utilise this package in the Microsoft Maui Blazor Hybrid project to implement a Login flow? It seems pretty tightly coupled to the ABP architecture.
Q. Also can you please comment on why the ABP Maui Blazor Hybrid will not startup without connectivity to the Server as we haven't received an answer to our overall question. If we could resolve that we wouldn't have to try and roll our own Maui Blazor Hybrid Client
-
0
Another 5 days have gone by with no response, and 13 days since our initial question, which remains unanswered. Can someone in support please assist with this question?
I'll repeat it here for clarity
Q. Also can you please comment on why the ABP Maui Blazor Hybrid template will not startup without connectivity to the Server?
If any further information is required then please let us know.
Thank you.