Posts

Showing posts from December, 2017

Firebase Database in Android with Phone Authentication - Kotlin

Image
Configure Database: (a) Go to https://console.firebase.google.com/ (b) Then click Add Project , a dialog will be prompted. Enter project name and choose country in it and click on Create Project . (c) Click on Add Firebase to your Android App, another dialog will be prompted. In that, enter package name and SHA-1 (compulsary for using Database) and click Register App . (d) Then download google_services.json file, by clicking download button and put that file in your module's root directory. (e) Then navigate to Database on Side tab and click on Get Started. Initially the Database rules will be like, { "rules" : { ".read" : "auth != null" , ".write" : "auth != null" } } Below rule is to allow everyone to read and write data without any authentication. { "rules" : { ".read" : true , ".write"

Firebase Storage - Upload Files - Kotlin

Image
Let's see how to upload the file to Firebase storage and download the same. Its really easy to upload files to Storage and it supports any type of files.  Preparing Firebase Console: (a) Go to https://console.firebase.google.com/ (b) Then click Add Project , a dialog will be prompted. Enter project name and choose country in it and click on Create Project . (c) Click on Add Firebase to your Android App, another dialog will be prompted. In that, enter package name (SHA-1 and App Nickname are optional) and click Register App . (d) Then download google_services.json file, by clicking download button and put that file in app's folder. (e) After that click on Storage on Side tab. Then click on Rules in that page. Make changes as follows: Code: project-level gradle: Add google service in dependencies buildscript { ext.kotlin_version = ' 1.2 . 10' repositories

Stripe Integration in Android - Kotlin

Image
Stripe is one of the simplest payment gateway to be used. It enables us to process payments in minutes. Let's see how to integrate Stripe in Android using Kotlin. Operational Flow:             1. App should provide order details to Stripe server and the order total will be returned to App.             2. Then the user will enter the payment/card details. That will be sent to Stripe server and the result of the request will be sent back to the App. Create Stripe Account: (a) Go to  https://dashboard.stripe.com/register and enter all your details and create account.   (b) Click API in side tab. Make sure that the Account is in Test mode. And make a note of          Publishable Key and Secret Key for use. Code: build.gradle:   compile 'com.stripe:stripe-android:5.1.0' Layout files: main_layout.xml: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:an

Braintree Integration in Android - Kotlin

Image
Let’s learn how to integrate Braintree in Android app with Kotlin. Braintree is a subsidary of PayPal. It focuses in helping businesses of all size and to help maximize business growth. Braintree accepts the following payments: * Credit Cards                             * Venmo                             * Android Pay                             * Apple Pay                             * PayPal Operation Flow: 1. App have to request token from the server. 2. Server have to generate a token using Braintree’s SDK and send that to the requested App. 3. With that Token, app should allow user to pay, which will be validated by Braintree’s server and then the payment nonce will be received. 4. That received payment nonce and paid amount will be sent to our own server. There the payment will be checked whether its successful or not and the response will be s