Flutter firebase dynamic link social tags info not showing at all - flutter

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

Related

Adding ofl to dynamic links firebase 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"

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

Flutter: url launcher facebook and instagram showing it may be broken

await launchUrl(
Uri.parse(
'https://www.facebook.com/$fbid',
),
mode: LaunchMode.externalApplication);
I have this launch url mode. The address works when I use it on my browser however, it does not when I use it inside the Flutter app. It says The link you followed may be broken, or ....
Twitter works fine but Instagram and FB are the ones that cause the error. I feel like something must be done for meta apps that I am missing right now. How can I fix this?
if (Platform.isAndroid) { var fbUrl = "fb://facewebmodal/f?href=" + "https://www.facebook.com/$fbid "; //for android launchFacebook(fbUrl, "https://www.facebook.com/$fbid"); }

Flutter Firebase Authentication with Email Links not working

I'm following this guide, I'm having this code:
var acs = ActionCodeSettings(
url: 'https://example.com/auth/widget',
androidPackageName: 'com.example',
iOSBundleId: 'com.example',
handleCodeInApp: true,
androidInstallApp: true,
androidMinimumVersion: '12',
);
var emailAuth = 'john.doe#pm.me';
FirebaseAuth.instance
.sendSignInLinkToEmail(
email: emailAuth, actionCodeSettings: acs)
.catchError((onError, stackTrace) {})
.then((value) =>
print('Successfully sent email verification'));
Sending the email works, but when I click on the email, then…
in iOS it opens https://example.com/auth/widget - which is the fallback
in Android it shows a circular loader for about 1s and then it "falls down" and nothing happens
The incoming link handler
FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {
print('got dynamic link! $dynamicLinkData');
}).onError((error) {
print('error error!');
});
I configured dynamic links in Firebase to point to to.example.com. I also added a manual dynamic link to.example.com/test which opens my app (the got dynamic link! message shows up) - so all seems fine, the problem seems to lie in the link generation.
The link structure I get by email is:
https://to.example.com/?link=https://example-abcd.firebaseapp.com/__/auth/action?apiKey…%26continueUrl%3Dhttps://example.com/auth/widget%26lang%3Den&apn=com.example&amv=12&ibi=com.example&ifl=https://example-abcd.firebaseapp.com/__/auth/action?apiKey%3D…%26continueUrl%3Dhttps://example.com/auth/widget%26lang%3Den
After some more painful hours of debugging and reading documentation I finally found it out. Most of this is in the flutter documentation, but since the documentation has broken links and is a bit all over the place it was hard for me to catch it all!
Android
I needed to decrease the androidMinimumVersion from 12 to 1. Then my app opens and I can receive the dynamic link. No idea why. My android simulator is android version 13 but the app never opened.
Before decreasing the android version I also set the sha256 setting in firebase, using gradlew signingReport documented in this answer. Not sure though this was required.
iOS
I forgot to do all the steps documented in receiving links on iOS section, namely:
add the dynamic links domain into associated domains
add FirebaseDynamicLinksCustomDomains into Info.plist
Overall, I found that to get this feature working was really really hard for me as a Flutter beginner. But I guess a lot of the setup I can re-use as the dynamic links capability seems to be something which comes in handy in the future.

Is there any method to share text from mobile web to wechat by sharing button?

I am looking for wechat sharing function like how whatsapp does.
href="whatsapp://send?text=http://www.example.com"
Based on my research, most of them will be encoded in QR code and scan the QR code with wechat scanner. Is there a way to share the text directly to friend when click on sharing button just like how whatsapp does?
Wechat doesn't have any official deep linking URL for sending a text. However, if you can add some JavaScript Code in your mobile web, you can achieve the share functionality.
Check out Send to chat documentation on Wechat JS SDK.
From JS SDK Documentation:-
wx.onMenuShareAppMessage({
title: '', // Sharing title
desc: '', // Sharing description
link: '', // Sharing link
imgUrl: '', // Sharing image URL
type: '', // Sharing type, such as “music”, “video “ or “link”. It is “link” by default.
dataUrl: '', // The data URL should be provided for items of type “music” or “video”. It is null by default.
success: function () {
// Callback function executed after a user confirms sharing
},
cancel: function () {
// Callback function executed after a user cancels sharing
}
});
We do have some unofficial deep linking URL like you mentioned. But it may stop work anytime if Wechat decided to change it.
Here is some of them below, sadly I don't know any URL to share a text to chat.
weixin:// - to open Wechat app (if installed)
weixin://dl/chat - to open chat screen of Wechat
weixin://dl/moments - to open user moements
weixin://dl/profile - to open user profile
weixin://dl/settings - to open settings page