Ipify allows users to get current public IP address for connected network in real-time

Overview

Ipify-Android

Ipify allows you to get current public IP address when connected to internet in real-time

Add Dependency

Use Gradle:

Step 1: Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
      ...
      maven { url 'https://jitpack.io' }
    }
}

Note: In New Android studio updates, now allProjects block has been removed from root build.gradle file. So you must add this repository to your root settings.gradle as below:

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
      ...
      maven { url "https://jitpack.io" }
  }
}

Step 2: Add the dependency in your module's (e.g. app or any other) build.gradle file:

dependencies {
    ...
    implementation 'com.github.chintan369:Ipify:<latest-version>'
}

How do I use Ipify-Android?

Step 1

Initialize Ipify in your application class of Android app's onCreate() method

public class MyApplication : Application() {
    ...
    
    override fun onCreate() {
        super.onCreate();
        
        Ipfy.init(this) // this is a context of application
        //or you can also pass IpfyClass type to get either IPv4 address only or universal address IPv4/v6 as
        Ipfy.init(this,IpfyClass.IPv4) //to get only IPv4 address
        //and
        Ipfy.init(this,IpfyClass.UniversalIP) //to get Universal address in IPv4/v6
    }
    ...
}

Step 2

Observe IP address at anywhere in your application. This function will provide you an observer to observe the IP address while changing the network connection from mobile data to Wi-Fi or any other Wi-Fi.

    Ipfy.getInstance().getPublicIpObserver().observe(this, { ipData ->
          ipData.currentIpAddress // this is a value which is your current public IP address, null if no/lost internet connection
          ipData.lastStoredIpAddress // this is a previous IP address while network lost/reconnected and current IP address assigned to null/new one
    })

This is how you can get a public IP address without doing any more code! 😄

Feel free to post any issue if you found on this library 😄 !

If you ❤️ this library and my hard work, you can buy me a coffee at link here

Buy Me A Coffee

You might also like...
Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.
Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

Book Parking is a demo application based on MVVM architecture. The app allows users to booking parking slots, the app uses firebase for the backend.

An android app which allows users to display the data of any excel sheet in rows and columns
An android app which allows users to display the data of any excel sheet in rows and columns

ExcelReader App description An android app which allows users to display the data of any excel sheet in rows and columns. Features Display data of an

KeyCip - an Android app that allows users to encrypt, decrypt and sign text, photos, videos and other files
KeyCip - an Android app that allows users to encrypt, decrypt and sign text, photos, videos and other files

KeyCip is an Android app that allows users to encrypt, decrypt and sign text, photos, videos and other files. To accomplish this goal, it relie

An app that allows you to search for Github profiles of users and their repositories [d.light Android Engineer Test], for the Android Engineer Role
An app that allows you to search for Github profiles of users and their repositories [d.light Android Engineer Test], for the Android Engineer Role

An app that allows you to search for Github profiles of users and their repositories [d.light Android Engineer Test], for the Android Engineer Role

SlushFlicks has been built upon public APIs from IMDB.
SlushFlicks has been built upon public APIs from IMDB.

SlushFlicks SlushFlicks has been built upon public APIs from IMDB. This application helps users to view trending, popular, upcoming and top-rated movi

German public broadcasting live streams as an Android app
German public broadcasting live streams as an Android app

Über FAQ Changelog Bibliotheken Über Zapp ist Teil von MediathekView und gibt dir einen schnellen Zugang zu vielen deutschen öffentlich-rechtlichen Fe

An app for developers which contains more than 2.4k+ resources , with 1.2k+ free public API documentation
An app for developers which contains more than 2.4k+ resources , with 1.2k+ free public API documentation

ResourceUp We often spend a lot of time finding good resources to get started with our project right? ResourceUp aims to provide all useful resources

Tonomy ID is the cross-platform mobile wallet (Android and iOS) for public and private EOSIO blockchains

Tonomy ID is the cross-platform mobile wallet (Android and iOS) for public and private EOSIO blockchains. This application allows you to sign transactions on the block chain, share your DID and Verifiable Credentials containing your identity with others in a consensual way and log into web2 and web3 applications. If you lose your phone several mechanisms exist to allow you to recover your account without trusting anyone with custody of your private keys.

An android application that displays public apis' for developers to use
An android application that displays public apis' for developers to use

An android application that displays public apis' for developers to use. This application implements adaptive layout by use of a sliding pane layout

Comments
Releases(1.0.1)
Owner
null
An app allows the users to get top news about their countries

News App This app allows the users to get top news about their countries. In the following figure, you can find the developed architecture: App consis

null 0 Oct 16, 2021
Episodie is a TV show time tracker app with unusual design written in kotlin and clean architecture approach. Get to know how much time you spent watching tv shows.

Episodie Episodie is a TV show time tracker app with unusual design. Get to know how much time you spent watching tv shows. Track easily overall progr

Przemek 126 Dec 7, 2022
A mobile application that allows you to get random information every time you enter the application.

Knowledge Repository A mobile application that allows you to get random information every time you enter the application. Google Play Store : Screensh

Nisa Efendioğlu 2 Jul 10, 2022
Bitcoin Market app shows you the current Bitcoin market price and price chart of different time intervals 💰

Bitcoin Market ?? Bitcoin Market app shows you the current Bitcoin market price and price chart of different time intervals Tech stack and whys ?? Kot

Cafer Mert Ceyhan 320 Jan 4, 2023
when you use restful api and network get disconnect you have to store your data local for make your app faster and work on ofline mode

AppArchitectureOflineMode when you use restful api and network get disconnect you have to store your data local for make your app faster and work on o

Kareem-Mansy 3 Jun 20, 2021
This android app fetches the data from the USGS API in real time to display a list of earthquakes.

This android app fetches the data from the USGS API in real time to display a list of earthquakes. On clicking an earthquake it opens a browser window with the complete information of the earthquake along with the location on a map.

null 5 Jan 11, 2022
A real time notification App which reminds its user with daily schedules

On Time Pro ⌚ A real time notification App which reminds its user with daily schedules, time-table ⌛ , due assignments ?? , regular classes with just

Elevate Lab 3 Feb 1, 2022
Real time gps location based alarming system tracking the road accident and providing medical assitance plus concern from near by police station.

Real time gps location based alarming system tracking the road accident and providing medical assitance plus concern from near by police station.

Sandeep Verma 1 Mar 12, 2022
Communicating between Wear OS and Android device using the OpWear module and a sample of displaying real-time camera on the watch and sending commands to the mobile by Wear OS.

OpWear-Cam Communicating between Wear OS and Android device using the OpWear module and a sample of displaying real-time camera on the watch and sendi

AmirHosseinAghajari 6 Nov 8, 2022
Android application that allows users to take or import photo of chessboard, recognizes the pieces and generate the Forsyth-Edwards Notation.

♛ ChessBoard Importer Frontend ♛ Repository for the frontend part of project "Chessboard Importer". The project is realized by the team of 4 students

null 8 Feb 26, 2022