This is an Android's library that is designed to be used as a plugin within Unity's project. It is created using Android Studio 3.6 and should consist of all projects files required by the IDE if one desires to tweak its functionality to his or hers needs.
The main purpose of this library is to allow the user to retreive platform related information within Unity's project and currently includes:
- retreiving information regarding the state of the network via
isNetworkAvailable
- determining established connection type via
IsConnectedViaCellular
andIsConnectedViaWifi
- determining if a device on which the app is running is of Tv-type via
isAndroidTv
- text based message sharing with the use of Android's Intent mechanism via
shareText
-
Clone awu repository and build the library using Android Studio yourself or download the latest .aar library release from here
-
Copy the .aar library file into your Unity's project Assets/Plugins/Android directory
-
(Optional) In Unity select the .aar library file from Project window and mark the option Load on startup from the Inspector
- Copy Unity's C# implementation available from here into your Assets/Scripts
Upon finishing the integration process described above you should be able to take advantage of library's functionality.
In your C# Unity's code you can use it in the following way:
bool isConnected = Awu.IsNetworkAvailable; // Let's check if we're connected to the internet
bool isTv = Awu.IsAndroidTv; // Let's check if the game is running on Android TV enabled device
bool isCellular = Awu.IsConnectedViaCellular; // Is mobile data connection established
bool isWifi = Awu.IsConnectedViaWifi; // Is wifi connection established
// Let's share our game with a friend via text message
Awu.ShareText("Share via", "My Awesome Game", new System.Uri("http://my.awesomegame.com"));
Projects utilising proguard obfuscation process should keep -keep class rixment.awu.** { *; }
within its proguard definition file.
Copyright 2005-2020 Rixment. Code released under the MIT license.