How to get parameters of a URI deep link into a Maui Application? - maui

I am want to create a deep link like some-app://localhost?user=123455 that when clicked opens a Maui WinUI app. When the app receives this deep link I want to be able to get the user ID off of the deep link. I was able to do this in Xamarin, but haven't figured out the Maui equivalent
I am able to register the app using (taken from this Windows doc):
<Applications>
<Application Id= ... >
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="alsdk">
<uap:Logo>images\icon.png</uap:Logo>
<uap:DisplayName>SDK Sample URI Scheme</uap:DisplayName>
</uap:Protocol>
</uap:Extension>
</Extensions>
...
</Application>
But when I receive the event via the app lifecycle (https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/app-lifecycle#windows) I am not seeing the parameters of the URI.

I've encountered the same problem and I got it working thanks to this reply on the issue I created.
You can retrieve the launch arguments by using Environment.GetCommandLineArgs(); inside of OnLaunched.

Related

How to interact with native apps using appium-flutter-driver & webdriverIO project

I'm using appium-flutter-driver & webdriverIO to automate the flutter mobile app.
I have a use case in my application where clicking on
Mail us button opens Gmail app with subject, body
Call us button opens Dailer app with phone number
I want assert/verify that gmail/phone app is opened. either one of following is fine
verifying that gmail/phone app package name
verifying the subject, content in gmail compose screen is also fine
I see here https://github.com/appium-userland/appium-flutter-driver that
await driver.switchContext('NATIVE_APP');
await (await driver.$('~fab')).click();
what is ~fab means here?
How to find elements using ID, text, class in this case and perform click, enterText, etc operations?
I'm not sure what ~fab means. But the available finders are mentioned here, with links to the documentation. The available commands are mentioned here, with links to the documentation.
An example of a finder by semantics label with a click:
element = FlutterElement(self.driver, FlutterFinder().by_semantics_label('Back'))
element.click()
An example of entering text:
driver.execute_script('flutter: enterText')
Got these examples from here.

Failure to Launch Apps Due to Package Name Inconsistency

When I used huawei AppLinking Serviceļ¼Œ the app package name is queried to locate the app details page. However, the app package name varies depending on the channel. For example, for a Huawei channel, the package name ends with .huawei, which is different from that in a Google channel.Does this mean it's impossible for an App Linking link to be opened in all local app stores due to package name inconsistency?
Does this mean it's impossible for an App Linking link to be opened in
all local app stores due to package name inconsistency?
The answer is no because there is a solution to this problem.
Perform the following to resolve the issue:
We know that App Linking can redirect users to a custom website if the app has not been installed, so you can use Android intents to create custom links, in which you can configure the package name and fallback URL to be opened. The basic syntax is as follows:
intent:
HOST/URI-path // Optional host
#Intent;
package=[string];
action=[string];
category=[string];
component=[string];
scheme=[string];
S.browser_fallback_url=[encoded_full_url]
end;
Taking advantage of the preceding functions, you can:
Create a link of App Linking and use the setOpenType(CustomUrl) method to set the open type to redirect users to a custom website for the Android platform. The involved APIs are as follows:
.setAndroidLinkInfo(new AppLinking.AndroidLinkInfo.Builder()
.setAndroidDeepLink(Android_LINK)
.setOpenType(CustomUrl)
.setFallbackUrl(BACK_LINK)
.build())
Use an Android intent to configure the preceding custom website. Here, I use Taobao as an example:
"intent://details?id=com.taobao.taobao#Intent;scheme=appmarket;package=com.huawei.appmarket;S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.taobao.taobao;end"
The process is as follows:
1.Use the appmarket scheme to start the app whose package name is com.huawei.appmarket, that is, to open HUAWEI AppGallery.
2.Pass the package name com.taobao.taobao to HUAWEI AppGallery. Then, HUAWEI AppGallery will start this package.
3.If com.huawei.appmarket is not found, set S.browser_fallback_url to a fallback URL.
4.The fallback URL is a Google Play link. Simply set id in this URL to the name of the package to be opened. In this example, the ID is com.taobao.taobao.
Ensure that an App Linking project of the Android platform has been completed. For details, visit:
https://forums.developer.huawei.com/forumPortal/en/topic/0204442462434640048?fid=0101188387844930001
Open the original App Linking project and add the following information in bold:
String BACK_LINK = "intent://details?id=com.taobao.taobao#Intent;" +
"scheme=appmarket;package=com.huawei.appmarket;" +
"S.browser_fallback_url=https://play.google.com/store/apps/details?" +
"id=com.taobao.taobao;end";
AppLinking.Builder builder = new AppLinking.Builder()
.setUriPrefix(DOMAIN_URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(new AppLinking.AndroidLinkInfo.Builder()
.setAndroidDeepLink(Android_DEEP_LINK)
.setOpenType(CustomUrl)
.setFallbackUrl(BACK_LINK)
.build());
Test:
Install the demo on a device, create a link of App Linking, and add it to the note.
Uninstall the app to simulate the scenario where the app is not installed.
For a Huawei phone, tap Open/Download. On AppGallery that is displayed, open the Taobao details page. The following figure shows the Taobao details page in HUAWEI Browser.
For a non-Huawei phone, tap Open/Download. On Google Play that is displayed, open the Taobao details page. The following figure shows the Taobao details page in Google Chrome.
The problem is now resolved. If you encounter a similar problem, simply follow my example step by step and change the package name to resolve the issue.
For more details, please go to:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction?ha_source=hms1

Windows Phone 8 facebook login (Beta)

I've been going through the instructions here trying to implement the FB login via the FB Beta application: http://facebooksdk.net/docs/phone/sso/
I had it working for a while, however ever since the last Beta update, something started failing.
Whenever i get a callback to MapUri from the FB application, i don't get the proper Uri being passed in. The following code always fails (the uri contains mundane URIs of pages within the application, not what i expected).
AppAuthenticationHelper.IsFacebookLoginResponse(uri)
I might have changes something on the web-configuration of the application, or on the WP8, however going over the settings, nothing seems to be working.
I checked the usual suspects (AppIds, ProductIds etc...) and it seems to be running properly, so that changing one of those IDs throws the error like i expect it to, however when i have setup everything properly, i get the facebook application to open my application, however the UriMapperBase when it get's called never has the proper Uri in it.
Here is the configuration for the WMAppManifest for the extension:
<Extensions>
<Protocol Name="msft-54045783c54e4c3a9f2b470c5b7ba353" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions>
Any ideas?
P.S. I am testing this on real devices with the latest FB Beta application.
UPDATE: Seems to only affect Samsung phones, no issues with HTC, haven't tried other ones.

How to call SOAP service from Phonegap (iPhone app)

I am trying to call a SOAP service using this SOAP client but it is not working for me. Please help me. How can I send and receive XML SOAP with Phonegap?
Phonegap is HTML/JS/CSS commonly communicating via XHR/Ajax. It's better to use jQuery Ajax functions. You can get the details here.
Eg:
Posting-XML-SOAP-Requests
AJAX-Requests-Between-jQuery
Simple jQuery client to call a SOAP web service
If you find any cross-domain issues (or working in a browser and not working with simulator/device), please refer to the below steps.
Go to the Resources folder, you can see a file named Cordova.plist. Click on that and you can see the Root elements. Right click on the Root, add a row, set the key as ExternalHosts with type Array.
Expand the item, and add an item as item0. Give it type string and enter the value as '*'.
Don't forget to save the Cordova.plist after changes (just use cmd+s).

Redirect attribute of actionforward does not work in struts portlet bridge based portlet (JSR-168)

I did a lot of researching on the matter but cannot seem to find the answer to my question, so I hope you guys can help me out.
We have a struts 1.2.7 web app that we converted to a JSR-168 portlet using the Apache Struts Portlet Bridge.
This is all working very well except for one thing: the actionforwards that specify a redirect do not actually redirect to the specified action. These redirects DO work when running the app as a normal struts web app. Hence, we have a double submit problem in the portlet variant.
We make use of action chaining that ends with an action forwarding to a tile definition. For example:
<action path="/CreateIdmAccountSubmit" validate="true" input="catalog.createaccount.page" type="com.konakart.actions.login.CreateIdmAccountSubmitAction" name="CreateIdmAccountForm">
<forward name="FillRegistrationData" path="/FillRegistrationData.do" redirect="true"/>
</action>
<action path="/FillRegistrationData" validate="false" type="com.konakart.actions.registration.FillRegistrationDataAction" name="FillRegistrationDataForm">
<forward name="FillRegistrationDataPage" path="/FillRegistrationDataPage.do" redirect="false"/>
</action>
<action path="/FillRegistrationDataPage" forward="order.registrationdata.page"/> (tiles-def)
In this example the action /CreateIdmAccountSubmit processes a submitted form (POST) and creates an account in the db. After successfull creation the user is redirected to another action (/FillRegistrationData) which inits an order object and, on its turn, forwards to the orderregistration page which layout is defined in the tiles-defs.xml.
As I said this all works very well, form a functional perspective, but when a user hits f5 on the rendered order-registration-page the action /CreateIdmAccountSubmit is again invoked causing the account to be created double. As I said also this is not happening when running the app as a normal web app. Here, the mechanism works perfectly :)
I think that the problem is being caused by the fact that the redirect is done in the wrong phase but i am really not sure as why this does not work :)
Based on what I read I tried the fowllowing things to fix the redirect problem:
* specified the action that does the form submit as "actionUrl" in struts-portlet-config.xml (hoping that redirect is done in wrong phase?)
* replaced the normal html tag library by the struts-portlet variant (hoping that a valid url actionUrl was produced by my html:form that in some way made the redirect possible?)
These two steps did not seem to help and I am lost at how to accomplish a simple redirect in the portlet so that we can prevent the double submit problem.
Hope you guys can help me out!
I found the answer: the mechanism is dependent on the portal implementation. We use Liferay which does not work with redirects by default.
However, you can switch this on by declaring an element in liferay-portlet.xml called
<action-url-redirect>true</action-url-redirect>
This fixed the problem for us!