When my app run in background then i get link and it working fine but when my app was kill then i not get link when i open app from deep link.
here is my code for get link
This is my edited code
void initDynamicLinks() async {
FirebaseDynamicLinks.instance.onLink(
onSuccess: (PendingDynamicLinkData dynamicLink) async {
final Uri deepLink = dynamicLink?.link;
if (deepLink != null) {
print('---new deep link onLink**********************************${deepLink}');
Fluttertoast.showToast(
msg: "onLink handle ${deepLink}",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
//Navigator.pushNamed(context, deepLink.path);
}
},
onError: (OnLinkErrorException e) async {
print('onLinkError');
print(e.message);
}
);
final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
final Uri deepLink = data?.link;
if (deepLink != null) {
print('---new deep found************************************************');
Fluttertoast.showToast(
msg: "get?Initial handle ${deepLink}",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
// Navigator.pushNamed(context, deepLink.path);
}
}
I call initPlatformState() for init and it working fine when my app is run in background.
How can i get url when my app is in force stop
Now same problem onLink work but getInitialLink not work for first time open app from url
I set 2 sec delay for getInitialLink then it work.