Deep linking to a specific page / context in a mobile app

Hi Nikita, I thought you wanted access to the whole of the app, so I invited you to the GitLab repo. Would that be OK ?
Otherwise, I will find a way to send you those files.

Just send an archive of the files I asked for, Iā€™ll see what I can come up with.

In android/app/src/main/AndroidManifest.xml :

        <!-- Deep linking -->
        <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" android:host="app.ready4sea.com" />
        </intent-filter>
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="r4s" android:host="app.ready4sea.com" />
        </intent-filter>

In ios/Runner/Info.plist :

<key>CFBundleURLTypes</key>
<array>
	<dict>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>fbxxxxxxx</string>
		</array>
	</dict>
	<dict>
		<key>CFBundleTypeRole</key>
		<string>Editor</string>
		<key>CFBundleURLIconFile</key>
		<string></string>
		<key>CFBundleURLName</key>
		<string>app.ready4sea.com</string>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>https</string>
			<string>r4s</string>
		</array>
	</dict>
</array>

OK, so I sent you an email with an archive including both files. Can you confirm you received it ?
Thanks.

Thanks, I got all the information. Iā€™m investigating.

Lovely.

Hello, @Nicolas_REMY.

For this logic you need to handle when app got deep link or universal link, like this(with uni_links) and this(with native). I havenā€™t been able to get this to work on iOS yet. I have tried third party libraries such as: uni_links and go_router.

Tomorrow I will try to implement it with native code.

By the way, the demo you posted. Did your link contain an https scheme or a custom one?
It looks like this wonā€™t work inside a Webview if the link is opened from a browser (with the https scheme).
If with https, let me know how you achieved it. :slightly_smiling_face:

If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded SFSafariViewController , WKWebView , or UIWebView object, iOS opens your app.

Source: App Search Programming Guide: Support Universal Links

Best Regards, Nikita.

Hi @Nikita_Fedorishchev ,

The link was indeed with an https scheme, so I can tell you it does work :wink:

I donā€™t remember all the details, but I believe it was thanks to both files I sent you, and also the subdomain has to be recognized by the device.

For iOS I think this is done via an apple-app-site-association file in the .well-known folder. But I canā€™t check now because my app is offline due to the ransomware.

For Android, I believe this is done in the lines I posted above.

This page may also help to understand the process.

Hello, @Nicolas_REMY.

I have good news, I got my deep link to work as expected. Soon, I will update the github repository where you can get the latest code.

Best Regards, Nikita.

That is very good news.
Is this for Android as well, or iOS only ?

Thanks.

DeepLinks will work for both.
A said about problems with onClick handler only for push notifications in Android.

1 Like

Do you have a target date for pushing to the github repository ?

Hello, @Nicolas_REMY.

I will push tomorrow.

Regards, Nikita.

1 Like

Hello, @Nicolas_REMY.

Repo has been updated.
But be careful, because during the pull, you can overwrite all your local changes.
Just in case, create a backup of the project, and then selectively rebase your branch with the new changes.

P.S:
This method opens the page when it receives a deep link. Rewrite it if necessary.

Best Regards, Nikita.

1 Like

OK, thanks a lot.
Yes I always run through each modification before merging them.

PS : Which method are you talking about that I should rewrite ?

Sorry, I had forgotten to add link. I updated my answer.

1 Like

I tested the solution and it works. This is a great improvement !

One lingering question, though :

If the app was not open on the phone, not even in the background, then it opens and goes to the right page. That is the expected behavior.

On the other hand, if the app was already open on the phone, but in the background, then clicking on the link switches over to the app, OK, but then it completely reloads the single page app. Would it be possible instead to emulate the Codeless ā€œGo To Pageā€ block or the BackendlessUI.Navigator.goToPage method ? I mean, would it be possible to just go to the specified page without reloading the whole app ? Indeed this takes a lot of time and the experience is not that great for the user.

Still, thank you for the enhancements which make it already a lot better than before !

Hi, @Nicolas_REMY.

Yes, you can do it. You just need add event in switch case like GET_CURRENT_VERSION method. Then subscribe into event in your UI Builder app. And replace this line to call your event, then event is be triggered in your codeless app, and you just need to call go to page:

If you have another questions let me know, I will glad to help you :slightly_smiling_face:

Best Regards, Nikita.

1 Like

OK thanks, I will have to try this in my next version. Iā€™ll come back to you if I have any doubts.

1 Like