Closed mkbsugita closed 9 months ago
are you find the solution?
@BhargavJani Did you meet same bug?
I guess I should get url from the code of Decomposed usage
in README.
final uri = await _appLinks.getLatestAppLink();
If you launch the plugin before your flutter app you need this:
WidgetsFlutterBinding.ensureInitialized();
This method will allow to access native code before inflating the app view tree.
If it's not the case or already having this, could you attach a simple android reproducer?
Same issue here on Android
First, thank you for this lib. I appreciate your work. However, we face the same issue as mentioned above: when a user opens the app with a deeplink and the app is created from scratch, getInitialAppLink()
returns 'null' and the deep linking fails. It works well when app is in background.
The behaviour is the same on Android and iOS.
Here's the code:
Future<void> main([List<String>? param]) async {
WidgetsFlutterBinding.ensureInitialized();
await firebaseInitializer.initFirebase();
...
runApp(MyApp());
}
class MainScreen extends ConsumerStatefulWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
initDeepLinkListeners(context, ref);
...
}
Future<void> initDeepLinkListeners(BuildContext context, WidgetRef ref) async {
final _appLinks = AppLinks();
Uri? initialDeepLink = await _appLinks.getInitialAppLink(); // this is 'null' when app is created fresh; otherwise it works!
...
}
}
Is this setup correct?
I guess not.
AppLinks
has nothing to do in a build method because there's nothing related to BuildContext
(even if your use case is to do something with it).For resolving purpose, move AppLinks()
intanciation to main function to see if the very first link is now catched.
You can leave the code as it is in your example. While AppLinks()
is not singleton the underlying platform will act as one. I will enforce this in later version.
I'm also facing the same issue. It's working fine in foreground or background state but not in the terminated state.
Can you just read the comment above yours?
I need to instanciate the plugin early to register it to the engine. After this, in your flutter app, use it normally.
Describe the bug
If the app wake up, it can work. But I killed the app it can't work.
Does it related to
[ ] App Links (Android)
[o ] Deep Links (Android)
[o ] Universal Links (iOS)
[ ] or Custom URL schemes? (iOS)
Does the example project work?
[o ] Yes
[ ] No
[ ] Irrelevant here
Did you fully read the instructions for the targeted platform before submitting this issue?
Uploaded your files to webserver, HTTPS, direct connection, scheme pattern setup, ...
[ ] Yes
[o ] No
[ ] Irrelevant here