Code Monkey home page Code Monkey logo

the16bitgamer / unitynetworkcheckforandroidandios Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 49.24 MB

Unity Network Check For Android and iOS, add the ability in your Andorid and iOS Unity Projects to detect if you application is Online. And if it is online, is it connected with a Mobile Data Service or Wifi.

License: MIT License

C# 38.45% Objective-C++ 16.73% Java 11.63% HTML 33.19%
unity android ios mobile-app mobile-development internet internet-connection mobile-data wifi csharp cpp aar

unitynetworkcheckforandroidandios's Introduction

UnityNetworkCheckForAndroidandiOS

Adding Network Check to your project

  1. Download the Netwrok Check Unity Package
  2. Import the Custom Pagacke into your Assets Folder

Adding Network Check to your Code

I've included a sample program which goes through all of the programs functionality called NetworkCheckExample.cs but I will also go over the basic funtionality bellow

To initilize the Network Check you need to call

NetworkCheck networkCheck = new NetworkCheck();

In NetworkCheck you will have access to 3 functions:

  1. networkCheck.CheckOnline
    • This will check if the device is online at any point in time
  2. networkCheck.CheckWifiState
    • This will check to see if the Wifi router on the device is connected to the internet
  3. networkCheck.CheckMobileState
    • This will check to see if the device is connected to the internet with Mobile Data

Testing

Since this module is designed to work on mobile devices there is no way to test the native code in Unity Editor.

To assist with development and testing I added Debug Toggles in the Unity Editor Winodw. Under 16Bit Networking there is 2 toggles:

  1. Enable Wifi Debug

  2. Enable Mobile Debug

These can be toggled at run time.

Required files

The main class NetworkCheck.cs is in ./Assets/Plugins/16 Bit Networking/ and can be moved if needed

The menu code is located in NetworkMenuToggles.cs and is in ./Assets/Plugins/16 Bit Networking/ and can be moved if needed

For Android to work you will need to include networking-release.aar in ./Assets/Plugins/Android/ which is already included in the package

For iOS to work you will need to include NetworkCheck.mm in ./Assets/Plugins/iOS/ which is already included in the package

##Source

The Android source files can be found here

The iOS Source files are located in the ./Assets/Plugins/iOS/ folder under NetworkCheck.mm

unitynetworkcheckforandroidandios's People

Contributors

the16bitgamer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qinzhaojin666

unitynetworkcheckforandroidandios's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.