drenther / upi_pay

Flutter plugin for UPI (Only in India)
MIT License
60 stars 73 forks source link

Some devices cannot find installed UPI apps list on android sdk 30, it works fine on sdk 29 and below, can anyone explain what to do for sdk 30 #25

Closed Coding-avatar closed 3 years ago

Coding-avatar commented 3 years ago

this is my code for fetching installed apps list

List<ApplicationMeta> upiApps = List();

@override
void initState() {
    super.initState();
    amount = widget.amountToAdd;
    SharedPreferences.getInstance().then((sharedPrefs) {
      authToken = sharedPrefs.getString(Constants.SHARED_PREF_AUTH_TOKEN);
      merchantId = sharedPrefs.getString(Constants.MCC_CODE);
      upiAddress = sharedPrefs.getString(Constants.UPI_ADDRESS);
    });
    UpiPay.getInstalledUpiApplications().then((upiApps) {
       setState(() {
          this.upiApps = upiApps;
       });
     });
}
drenther commented 3 years ago

It may be because of this https://proandroiddev.com/how-to-get-users-installed-apps-in-android-11-b4a4d2754286

@reeteshranjan What are your thoughts?

reeteshranjan commented 3 years ago

Yes and I think that's the subject here as well https://github.com/azhar1038/UPI-Plugin-Flutter/issues/39

drenther commented 3 years ago

@reeteshranjan We will need to add explicit view intent for all the UPI apps we are supporting detection for in Android as of now

reeteshranjan commented 3 years ago

@reeteshranjan We will need to add explicit view intent for all the UPI apps we are supporting detection for in Android as of now

It's better someone with an Android 10 and 11 phone adds and tests. I don't have any of them. Android 10 should be included as per https://github.com/drenther/upi_pay/issues/29#issuecomment-855422681.

imyogisingh commented 3 years ago

I thought my code is not working ! Saw here it's the issue in the package . hope you will fix this

reeteshranjan commented 3 years ago

@drenther I think we should explore getting an open source developer account with any of the mobile device cloud services like kobiton for effective testing across different platforms. I am putting up a list of few services I scouted recently.

I have open source accounts with the 1st three in the list below that I got for testing my open source work https://github.com/cross-browser-tests-runner/cross-browser-tests-runner and https://github.com/browsejs/browse.js. I have not done any open source testing on these for a while now; but if I remember correctly there were restrictions on availability of physical devices across all of them.

I guess it's better to look at them afresh and work with their sales team to describe this package and get an account such that we have access to at least one device per major/minor iOS and Android version.

https://saucelabs.com/ https://www.browserstack.com/ http://crossbrowsertesting.com/ https://www.perfecto.io/ https://bitbar.com/ https://awsdevicefarm.info/ https://firebase.google.com/products/test-lab/ https://kobiton.com/ https://digital.ai/ https://www.pcloudy.com/ https://www.headspin.io/

sky1095 commented 3 years ago

Any fix for this? or in development?

drenther commented 3 years ago

We have a fix on the paper but haven't been able to push and test yet.

@reeteshranjan and I are working on getting access to services to test this but facing some challenges there.

It would be of massive help if anyone with access to Android 10 and 11 devices can make a PR and test it.

We will help with the implementation.

sky1095 commented 3 years ago

yeah sure, let me know where to get the code to test on my device

reeteshranjan commented 3 years ago

@sky1095 @imyogisingh expect a fix in 2 days

reeteshranjan commented 3 years ago

@sky1095 @imyogisingh could you please install the example app from this fork https://github.com/reeteshranjan/upi_pay on an Android 11 phone and let me know if things work? The apps you are looking to detect must have been setup to get your bank accounts configured.

sky1095 commented 3 years ago

96893830-65e9-4dd6-8d45-4cf7b14a0585 Still can't see the UPI apps @reeteshranjan

reeteshranjan commented 3 years ago

Thanks! A new commit added. Please try with it and let me know.

sky1095 commented 3 years ago

image still no luck! I have tried adding these intent queries in my fork by following the commit from another plugin which is surprisingly working on android 11: https://github.com/azhar1038/UPI-Plugin-Flutter/commit/6af72da1bb31e2d17097f1f8f1dfc9a03f8e8725

sky1095 commented 3 years ago

image still no luck! I have tried adding these intent queries in my fork by following the commit from another plugin which is surprisingly working on android 11: azhar1038/UPI-Plugin-Flutter@6af72da

https://github.com/azhar1038/UPI-Plugin-Flutter -> This plugin is working on my end

sky1095 commented 3 years ago

image @reeteshranjan https://github.com/azhar1038/UPI-Plugin-Flutter plugin works with the same code you have pushed!

reeteshranjan commented 3 years ago

image still no luck! I have tried adding these intent queries in my fork by following the commit from another plugin which is surprisingly working on android 11: azhar1038/UPI-Plugin-Flutter@6af72da

Great! Could you please submit a PR from your fork?

sky1095 commented 3 years ago

image still no luck! I have tried adding these intent queries in my fork by following the commit from another plugin which is surprisingly working on android 11: azhar1038/UPI-Plugin-Flutter@6af72da

Great! Could you please submit a PR from your fork?

No I mean even after applying the changes from other plugins, it wasn't working. Else I would have created a PR

reeteshranjan commented 3 years ago

@sky1095 ok understood. Could you give one last try to latest commit in my fork? At this point, I have no logical explanation after looking at your updates; but trying to keep the changes very similar to upi-india in terms of syntax and see. Please let me know once you have tried.

sky1095 commented 3 years ago

@reeteshranjan already tried but still no luck, your changes are the same as what UPI-india did yet their code is working. I am also trying to figure out the difference we are missing out

reeteshranjan commented 3 years ago

@reeteshranjan already tried but still no luck, your changes are the same as what UPI-india did yet their code is working. I am also trying to figure out the difference we are missing out

Just to clarify: I had added a commit before my new comment. Just wanted to ensure that you have tried the latest version. Please check and confirm.

reeteshranjan commented 3 years ago

I have bought an Android 11 phone as this "remote debugging" is painful. Getting delivered tomorrow. Will update in few days.

sky1095 commented 3 years ago

@reeteshranjan any luck on this issue?

reeteshranjan commented 3 years ago

@Coding-avatar @sky1095 @imyogisingh there is no issue found on Android 11 with the package.

In the 1.0.0 release, the getInstalledUpiApplications API behaviour was changed to return only those UPI applications that give no security warning or error for non-merchant payments. This was done for protecting general users that are not looking to use this package for research but towards stable production usage. To get all apps, you need to pass a flag (indicating you are someone researching/playing with apps). Please see the above documentation link for more.

I was able to get all apps with UPI account configured on my Android 11 device by specifying statusType: UpiApplicationDiscoveryAppStatusType.all.

My guess is that you have only those applications installed that are filtered out by default as they have been found to not work properly or work with a security warning. Hence, the above suggestion.

I have also modified the example app in my fork https://github.com/reeteshranjan/upi_pay to get all apps (by specifying the above flag). Please first try that out. Let me know if things do not work even with that.

reeteshranjan commented 3 years ago

@Coding-avatar @sky1095 @imyogisingh above comment was to first ensure that there is no error specific to API 29 on Android 11 that has been used by this package. I will update more on API 30 shortly today.

reeteshranjan commented 3 years ago

@Coding-avatar @sky1095 @imyogisingh changes are done to support API 30 in my fork https://github.com/reeteshranjan/upi_pay. Please run the example app in my fork, and also build and test your app with this fork for upi_pay in your pubspec.yaml and see if you can see all applications.

Please note that as per https://github.com/drenther/upi_pay/issues/25#issuecomment-867370776, you need to pass parameters to getInstalledUpiApplications to see all applications which was the default behaviour before 1.0.0.

reeteshranjan commented 3 years ago

@drenther, as you know Google wants everyone to move to API level 30. We could merge changes done in my fork. Have created a pull request #34 for you to review. Will yield v1.0.1.

reeteshranjan commented 3 years ago

@Coding-avatar @sky1095 @imyogisingh did you manage to find time to test with my fork?

Coding-avatar commented 3 years ago

No i haven't tested it yet, I will let you know by tomorrow

sky1095 commented 3 years ago

@reeteshranjan I have tested in the morning on my device, I can see the list of installed UPI apps showing in the example app.

reeteshranjan commented 3 years ago

@reeteshranjan I have tested in the morning on my device, I can see the list of installed UPI apps showing in the example app.

OK great. In case you were testing your own app, please let us know the status of things working in your app as well.

sky1095 commented 3 years ago

@reeteshranjan yes checked in my app too, works fine for showing the app. I just have one query like I need to open the respective app upon clicking it, but I can only see the option for initiating the transaction. I want to achieve to open the desired application

reeteshranjan commented 3 years ago

@reeteshranjan yes checked in my app too, works fine for showing the app. I just have one query like I need to open the respective app upon clicking it, but I can only see the option for initiating the transaction. I want to achieve to open the desired application

Please raise another ticket for this feature of "opening the app", other than initiating the transaction.

reeteshranjan commented 2 years ago

Is https://github.com/drenther/upi_pay/issues/38 relevant and important for you?

If yes, could you please respond to my twitter thread with UPI and NPCI handles included in your response asking how these must be solved and how it helps you? https://twitter.com/reeteshr08/status/1488746633068089345

@sky1095 @imyogisingh @Coding-avatar