Adding ofl to dynamic links firebase flutter - flutter

I want to add ofl so when the link is opened on a desktop it will go to the web version of the app
Here's my code where should I add it?
final DynamicLinkParameters parameters = DynamicLinkParameters(
// The Dynamic Link URI domain. You can view created URIs on your Firebase console
uriPrefix: uriPrefix,
// The deep Link passed to your application which you can use to affect change
link: Uri.parse(parsableLink),
// Android application details needed for opening correct app on device/Play Store
androidParameters: AndroidParameters(
packageName: androidPackageName, fallbackUrl: Uri.parse(webLink)),
// iOS application details needed for opening correct app on device/App Store
iosParameters: IOSParameters(
bundleId: iosPackageName, fallbackUrl: Uri.parse(webLink)),
//longDynamicLink: Uri.parse('$parsableLink&ofl=$webLink')
);
final ShortDynamicLink shortDynamicLink =
await dynamicLinks.buildShortLink(parameters);
print(shortDynamicLink);
return shortDynamicLink.shortUrl.toString();

Okay so I figured that out I had to add the longDynamicLink like this :
"$uriPrefix/?link=$parsableLink&apn=$androidPackageName&afl=$webLink&ibi=$iosPackageName&isi=$iosId&ifl=$webLink&ofl=$webLink"

Related

Open Reset Password Link within Flutter mobile App

In my Flutter Mobile App authentication is handled by my own server API
Currently I have an ask reset password feature in my mobile app which sends a reset password link to the user’s email inbox.
This link opens a web page inside the user’s browser, where they enter a new password.
Instead of opening a web page I’d like this link to open my mobile app at specific reset password route + persist & provide to that route the reset password code
What kind of attributes should my link have to achieve this behavior & provide the reset code to the route ?
Is there a way to achieve any of this without using Firebase Dynamic Links ?
What do I need to setup inside my Flutter App to achieve any of this logic ?
I’m using BLoC state management.
You have to use deep link and while creating the deep link if on mobile open the app and navigate to that page and if app is unavailable then take the user to the web page.. Deep linking is not connected to firebase auth.. Both are different services and deep link will work even without firebase auth.
EDIT
when creating deep link add the extra data in the link like the following
Future<Uri> createDynamicLink(String id) async {
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://your.page.link',
link: Uri.parse('https://{your URL}.com/?id=$id'),//<----id=some value is custom data that you wish to pass
androidParameters: AndroidParameters(
packageName: 'your_android_package_name',
minimumVersion: 1,
),
iosParameters: IosParameters(
bundleId: 'your_ios_bundle_identifier',
minimumVersion: '1',
appStoreId: 'your_app_store_id',
),
);
var dynamicUrl = await parameters.buildUrl();
return dynamicUrl;
}
To retrieve this
final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
Uri deepLink = data?.link;
if (deepLink != null) {
if (deepLink.queryParameters.containsKey('id')) {
String id = deepLink.queryParameters['id'];
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SomeScreen(id: id);
}
}
you can check this for reference
https://blog.devgenius.io/firebase-flutter-dynamic-links-step-by-step-guide-630402ee729b

App not setup: This app is still in development mode - Login through Facebook 2021

I'm trying to create a Login through Facebook button in my Flutter project using Firebase. I added all the things Facebook asked and I have also set my app in Live mode. But when I try to Login, it says
App not setup: This app is still in development mode.
Here's the code I've used in my flutter project:
Future<UserCredential> _signInWithFacebook() async {
final AccessToken result = await FacebookAuth.instance.login();
final FacebookAuthCredential facebookAuthCredential =
FacebookAuthProvider.credential(result.token);
return await FirebaseAuth.instance.signInWithCredential(facebookAuthCredential);
}
How do I solve this?

Flutter dynamic links how to set up other platforms fall back link?

I have used dynamic links in my flutter app and I create the link manually through codes through dynamic links package I have configured my link to open play store when not installed on Android and redirect to a particular website in ios and iPad but how to give a fall back link for other platforms ?
You can manually add ofl (or afl, or ifl) to the long Uri string and use it directly, or even build a short URL from it.
This code creates a DynamicLinkParameters variable parameters using the DynamicLinkParameters() constructor inside an async function, then uses it to create a short link that falls back to https://example.com on desktop:
final DynamicLinkParameters parameters = DynamicLinkParameters(
// constructor arguments
);
final Uri longLink = await parameters.buildUrl();
final ShortDynamicLink shortDynamicLink = await DynamicLinkParameters.shortenUrl(Uri.parse(longLink.toString() + "&ofl=https://example.com"));
final Uri dynamicLinkShortUrl = shortDynamicLink.shortUrl;

How to launch youtube from flutter app android?

I want to make the container click lead to a specific youtube url which should open in the the youtube app and not in webview inside the app.
add in pubspec.yaml:
dependecies:
url_launcher: ^5.4.2
add this in your code:
LaunchUrl('https://www.youtube.com');//or any link you want
You should look into the package android_intent. Basically it will resolve the url if it has been defined as a valid link for an application in your android parameters (which is enabled by default for youtube).
Code Sample
AndroidIntent intent = AndroidIntent(
action: 'action_view',
data: url,
);
await intent.launch();
you can use package url_launcher with the function below:
launchUrl(
Uri.parse("http://www.youtube.com/watch?v=${youtubeID}"),
mode: LaunchMode.externalApplication);

Flutter firebase dynamic link social tags info not showing at all

I have the below code which does generate the dynamic link correctly. However, when I share the link using Share plugin I just see the link text. Nothing else appears in the shared message. None of the social tags attributes are shown when the link is shared.
Second thing, the link also does not open in the browser - it always tries to find the app on google play store. My app isn't on the play store yet and I want it to always point to browser. The dynamic link I configured on playsore does open in the browser but the links created via code go to the play store - always. The DL I configured also does NOT show any social media info.
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://zakaas.page.link',
link: Uri.parse("https://firebasestorage.googleapis.com/v0/b/removed_strage/o/UserVideos%2F2020-06-21%2017%3A42%3A54.530730.mp4?alt=media&token=removed_token_value"),
androidParameters: AndroidParameters(
packageName: 'com.clidio.zakaas',
minimumVersion: 21,
),
navigationInfoParameters: NavigationInfoParameters(
forcedRedirectEnabled: false,
),
dynamicLinkParametersOptions: DynamicLinkParametersOptions(
shortDynamicLinkPathLength: ShortDynamicLinkPathLength.short,
),
socialMetaTagParameters: SocialMetaTagParameters(
title: 'Example of a Dynamic Link',
description: 'This link works whether app is installed or not!',
),
);
final Uri dynamicUrl = await parameters.buildUrl();
final ShortDynamicLink shortenedLink = await DynamicLinkParameters.shortenUrl(
dynamicUrl,
DynamicLinkParametersOptions(shortDynamicLinkPathLength: ShortDynamicLinkPathLength.unguessable),
);
Share.share('${shortenedLink.shortUrl}', subject: '${shortenedLink.shortUrl}');
OK. After a simple thought, I got this working now. I used a social app "HIKE" when I was testing and unfrtunately it did not work on hike. I don't use whatsapp for >2 years now but then I gave a try on friend's whatsapp and it did work . It shows image as well.
Thank you