What I Want to Do
When the user taps the URL, it launches the app and pops up a page within the app based on the included custom parameters.
Problem
I succeeded in launching an Android or iOS app by tapping the URL, but the custom parameter is always null.
What I Did
The URL that users tap is as follows.
https://example.page.link/test/?link=https://test.example.com/?id=${id}&apn=com.example.app
id is custom parameter that I want to get when this URL is called.
I created link on Firebase Console like example.page.link/test.
In initState, call initDeepLinks function.
// openPage opens detail page with id
Future<void> initDeepLinks() async {
final PendingDynamicLinkData? initialLink =
await FirebaseDynamicLinks.instance.getInitialLink();
if (initialLink != null) {
final Uri deepLink = initialLink.link;
print("A: " + deepLink.queryParameters["id"]!);
openPage(deepLink.queryParameters["id"]!);
}
FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {
print("B: " + dynamicLinkData.link.queryParameters["id"]!);
openPage(dynamicLinkData.link.queryParameters["id"]!);
}).onError((error) {});
}
But those two print()s print only A: or B: .
I checked URL that contains ?id=$id and it is correct.
Tried other URL
When I change the URL to
https://example.page.link/?link=https://test.example.com/?id=${id}&apn=com.example.app
(removed `/test` path)
It works with custom parameters only on Android.
But do same on iOS, the browser shows https://test.example.com page and app doesn't appear.
What should I do to make custom parameters?
Related
I am using below code to access gallery permissions in .net maui but it always returns Granted even on first time launch of the application and I am not able to see the permission popup saying "This app would like to access photos and media on your device"
public static async Task<PermissionStatus> GetMediaPermissionStatus()
{
PermissionStatus mediaResult = PermissionStatus.Disabled;
var tcs = new TaskCompletionSource<PermissionStatus>();
var status = await Permissions.CheckStatusAsync<Permissions.Photos>();
if (status != PermissionStatus.Granted)
{
status = await Permissions.RequestAsync<Permissions.Photos>();
}
tcs.SetResult(status);
return await tcs.Task;
}
Also when I execute below code getting 2 app permission Popups
1st Popup - "Allow application to take pictures and record video"
2nd Popup - "Allow application to access photos and media on your device?"
public async void TakePhoto()
{
if (MediaPicker.Default.IsCaptureSupported)
{
FileResult photo = await Microsoft.Maui.Media.MediaPicker.Default.CapturePhotoAsync();
if (photo != null)
{
// save the file into local storage
string localFilePath = Path.Combine(FileSystem.CacheDirectory, photo.FileName);
using Stream sourceStream = await photo.OpenReadAsync();
using FileStream localFileStream = File.OpenWrite(localFilePath);
await sourceStream.CopyToAsync(localFileStream);
}
}
}
I don't know if it is a bug or I am doing something wrong.
Any help is appreciated!
You can refer to this doc: Permissions of MAUI. There is a table in it. It uses ✔️ to indicate that the permission is supported and ❌ to indicate the permission isn't supported or isn't required
If a permission is marked as ❌, it will always return Granted when checked or requested.
Granted:
The user granted permission or is automatically granted.
Wish it can help you.
i'm using connectycube for receiving calls but when i accept call while is in the background like the image below
it navigates me the home page but not the call here is the code
void videocaller( var friendName){
Uuid uuid = Uuid();
CallEvent callEvent = CallEvent(sessionId: uuid.v4() + "1", callType: 1, callerId: 0,
callerName: friendName, opponentsIds:{1234});
Future<void> _onCallAccepted(CallEvent callEvent) async {
_joinMeetingVideo(friendName);
}
Future<void> _onCallRejected(CallEvent callEvent) async {
}
Future onCallRejectedWhenTerminated(CallEvent? callEvent) async {
}
Future onCallAcceptedWhenTerminated(CallEvent? callEvent) async {
_joinMeetingVideo(friendName);
}
ConnectycubeFlutterCallKit.onCallRejectedWhenTerminated = onCallRejectedWhenTerminated;
ConnectycubeFlutterCallKit.onCallAcceptedWhenTerminated = onCallAcceptedWhenTerminated;
ConnectycubeFlutterCallKit.instance.init(
onCallAccepted: _onCallAccepted,
onCallRejected: _onCallRejected,
);
ConnectycubeFlutterCallKit.showCallNotification(callEvent);
ConnectycubeFlutterCallKit.setOnLockScreenVisibility(isVisible: true);
}
i tried it with getx to navigate to jitsi call but it does not work
actually the problem is that jitsi function [_joinMeetingVideo(friendName);] is not a page where i can navigate to it's a function so it can't be executed enless the app is open this why it opens the home page of the app but not the video call itself but unfortunately i could't find a solution for this issue. any ideas ??
My Use Case:
Users in my app can create lists of items. I want the users to be able to share a link to one of their lists.
I want individuals who click the shared link to see the list of items in a web browser and not need the app installed.
Create the Dynamic Link
The first thing I need to do is create a dynamic link for a user to share. I struggled with this at first and then looked at this question here: Flutter - How to pass custom arguments in firebase dynamic links for app invite feature?
After looking at that I build my own class like so:
class PackDynamicLinkService {
Future<Uri> createDynamicLink({required String packID}) async {
final DynamicLinkParameters parameters = DynamicLinkParameters(
// This should match firebase but without the username query param
uriPrefix: 'ttps://appName.app/p',
// This can be whatever you want for the uri, https://yourapp.com/groupinvite?username=$userName
link: Uri.parse('https://appName.app/p?pack=$packID'),
androidParameters: const AndroidParameters(
packageName: 'com.test.demo',
minimumVersion: 1,
),
iosParameters: const IOSParameters(
bundleId: 'com.test.demo',
minimumVersion: '1',
appStoreId: '',
),
);
final dynamicLink = await FirebaseDynamicLinks.instance.buildShortLink(
parameters,
shortLinkType: ShortDynamicLinkType.unguessable,
);
return dynamicLink.shortUrl;
}
}
I then called that function in my app and I am able to get a URL that looks like this: https://appName.app/p?pack=lVeSBUHoLX52zPqAiB9A
So far so good. Now I just need to click the link and read the parameter $packID that I passed to it inside my web app. Then I can route them to the correct view and display the list.
Processing Dynamic Link
in my marin.dart I tried to retrieve the params with:
//get link stuff
final PendingDynamicLinkData? initialLink =
await FirebaseDynamicLinks.instance.getInitialLink();
if (initialLink != null) {
final Uri fullLink = initialLink.link;
print(fullLink.queryParameters['pack']);
}
but when I upload to firebase hosting to see if this code works for testing, I get this error:
Uncaught MissingPluginException(No implementation found for method
FirebaseDynamicLinks#getInitialLink on channel
plugins.flutter.io/firebase_dynamic_links)
After doing some more research it seems that firebase_dynamic_links package may not be available for web? So does that mean my original use case is not possible with flutter at this time?
You would want to take the link received and parse it using something like:
var PendingDynamicLinkData? initialLink =
await FirebaseDynamicLinks.instance.getInitialLink();
if (kIsWeb) {
String link = Uri.base;
initialLink = await
FirebaseDynamicLinks.instance.getDynamicLink(Uri.parse(link));
}
if (initialLink != null) {
final Uri fullLink = initialLink.link;
print(fullLink.queryParameters['pack']);
}
Here, we are checking if its a web app and then we can parse the dynamic link and get the info for it. We just check for the Uri that was used in our web app.
I want to navigate a user to a particular page on clicking a shared link based on the id passed in that link. I use dynamic link of Firebase for that. after configuring a dynamic link in the Firebase console manually. I use this code to create a link when sharing an app:
Future<Uri> createDynamicLink(String id) async {
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://asbdf.page.link',
link: Uri.parse('https://aspdf.page.link/createpost?id=$id'),
androidParameters: AndroidParameters(
packageName: 'com.sample.aspdf',
minimumVersion: 1,
),
);
print(parameters.link);
final ShortDynamicLink shortLink = await dynamicLinks.buildShortLink(parameters);
final Uri shortUrl = shortLink.shortUrl;
return shortUrl;
}
The sharing link works fine. After sharing the link on social media (whatsapp), when I click on that link, the app opens and causes an error. This is the code to retrieve deeplink:
final Uri deepLink = data.link;
print("deeplink found");
print(deepLink);
String? id = deepLink.queryParameters['id'];
print(id.toString());
Get.offAll(()=>AuthStatus(uid: id!));
This is because the app is opening the static deeplink which I configured in the console manually, not the link which was created programatically from the above code. So no parameters are taken by the link and the value of the id variable becomes null and causes an error. How can I fix this problem?
I work on a Flutter mobile app and I want to detect the first app launch to show a little tutorial to the user. I have tests the Shared-Preferences Module But when If I start the app for the first time The console tells me the key is not recognized, I think it's normal because this key does exist! There is another method for checking that?
Thank you guys
use shared preferences to store value that indicate if user has ever been in this page or not
like this
try {
final SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
splash = sharedPreferences.getString("SPLASH_DONE");
} catch (e) {
print("this is first time");
}
if (splash == null) {
page = AppSplashScreen();
} else {
page = LoginPage();
}
and after completing your first time operation call
sharedPreferences.setString("SPLASH_DONE", "DONE");