Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onChangedUrl is not working even my url changed sometime. #433

Open
smaharjan974 opened this issue Jun 3, 2019 · 12 comments
Open

onChangedUrl is not working even my url changed sometime. #433

smaharjan974 opened this issue Jun 3, 2019 · 12 comments

Comments

@smaharjan974
Copy link

I have a url like "mybase_url/?abc=abc12&code=123" and i click one of my view my url changed to mybase_url/abc/abc this url is not listened in onChangedUrl. Any Solution?

@adammesa
Copy link

adammesa commented Jun 3, 2019

Is your URL changing in the webbrowser? (i.e. does the new page load)

@smaharjan974
Copy link
Author

yes it is changing on web

@adammesa
Copy link

adammesa commented Jun 4, 2019 via email

@smaharjan974
Copy link
Author

smaharjan974 commented Jun 4, 2019

return WillPopScope(
child: WebviewScaffold(
key: scaffoldKey,
url: url,
resizeToAvoidBottomInset: true,
withJavascript: true,
scrollBar: true,
hidden: true,
appBar: AppBar(title: Text("Payment")),
),
onWillPop: () => _onBackpress(),
);

_onUrlChanged = flutterWebviewPlugin.onUrlChanged.listen((String url) {
print(url);
if (mounted) {
print(url);
if (url.contains("/payment/confirm")) {
// var uri = url;
Uri uri = Uri.parse(url);

      String paymentId = (uri.queryParameters["payment_id"]);
      String status = (uri.queryParameters["status"]);
      String paymentMethod = (uri.queryParameters["payment_method"]);
      String transactionId = (uri.queryParameters["transaction_id"]);
      String amount = (uri.queryParameters["amount"]);
      String customerCode = (uri.queryParameters["customer_code"]);
      String product = uri.queryParameters["product"];

      Navigator.of(context).pop({
        'payment_id': paymentId,
        'status': status,
        'payment_method': paymentMethod,
        'transaction_id': transactionId,
        'amount': amount,
        'customer_code': customerCode,
        'product': product
      });
    }
  }
});](url)

@hgouveia
Copy link

hgouveia commented Jun 24, 2019

onUrlChanged

is not working for me, when i use another plugin android_alarm_manager

https://pub.dev/packages/android_alarm_manager

in order to test it, is enought to setup the app, and just add the await AndroidAlarmManager.initialize(); on the main function and it stop working

import 'package:android_alarm_manager/android_alarm_manager.dart';

void printHello() {
  final DateTime now = DateTime.now();
  final int isolateId = Isolate.current.hashCode;
  print("[$now] Hello, world! isolate=${isolateId} function='$printHello'");
}

main() async {
  final int helloAlarmID = 0;
  await AndroidAlarmManager.initialize();
  runApp(...);
  await AndroidAlarmManager.periodic(const Duration(minutes: 1), helloAlarmID, printHello);
}

added bug report into flutter too, flutter/flutter#34982

@charafau
Copy link
Collaborator

Is it full page reload or just javascript reload ?

@hgouveia
Copy link

hgouveia commented Jul 3, 2019

Is it full page reload or just javascript reload ?

not sure if this is for me, but not, is a full reload, i think the issue is related with android_alarm_manager, added report there too

@estevez-dev
Copy link

Indeed after android_alarm_manager was initialized onChangedUrl stops working

@charafau
Copy link
Collaborator

@hgouveia thanks to @estevez-dev issue got discovered with alarm manager and workmanager, no fix yet unfortunately

@duongtruong12
Copy link

@charafau is there fixed yet?

@buidan
Copy link

buidan commented Feb 21, 2020

Hi @smaharjan974 @duongtruong12 .

I got the same issue but now i fixed in my app.

I was because of the url that app redirect to continue redirect to another url so sometime, in some devices it can not capture in that case. So remove the redirect on url of server side fixed my issue.

Hope this helpful!

@hgouveia
Copy link

hgouveia commented Apr 3, 2020

Hello, this issue seems to be solved already by flutter team flutter/flutter#34982

for me is working now, this might be closed, if you guys could confirm too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants