As you can see, we append five query parameters in the following order - pa, pn, tn, am, cu. The query parameters are key-value pairs which get added to the base URI path. This is achieved using the buildUpon() method on the ‘uri’ object and adding query parameters to it. We are building a URI path which will allow us to make the transaction. Let’s take a look at what this function does. After filling those out, we capture the values in the onClickListnener of the ‘send’ button and pass in all the required information into this function. In our app, it’s the four edit text fields. You need to call this function usually after you get all the information required for the transaction. So this function is responsible for adding UPI to your app. I’ll explain what this particular code snippet does - fun payUsingUpi(amount: String, upiId: String, name: String, note: String) Feel free to copy the code of the file as-is or directly jump to the part where we actually integrate UPI. I’ll skip through all the house-keeping stuff like initializing views et al. Our app only has a single screen and hence a single activity file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |