Skip to content

Commit 2b11ef9

Browse files
committed
readme updated
1 parent 0fc97b0 commit 2b11ef9

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Arupakaman Studios
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# Unity-Android-SDK-Plugins
1+
# Unity Android SDK Plugins
2+
3+
Unity Android SDK Plugins is an Open Source project that contains code to generate Android SDK/Plugins (.aar files) that can be used in an Unity project to implement/access native Android features.
4+
5+
## Available Plugins :
6+
7+
- pluginbasicutils - Provides basic Android util functions i.e. to show a toast, to check network connectivity [know more](/pluginbasicutils/README_PLUGINBASICUTILS.md)
8+
9+
## Usage
10+
11+
- Download the plugin .aar file that you want to use in your Unity project from releases or build it by yourself and paste the .aar file in your Unity project's `Assets/Plugins/Android` directory.
12+
- Use [External Dependency Manager](https://github.com/googlesamples/unity-jar-resolver) for Unity to resolve the dependencies used in the plugins.
13+
- Add project config ext variables in project level gradle like:
14+
```
15+
ext{
16+
compileTargetSDK = 31
17+
kotlin = '1.5.30'
18+
}
19+
```
20+
Check [build.gradle](build.gradle) for current config.
21+
- Check out usage code snippet for each plugin in their respective READ_ME files.
22+
23+
### Request
24+
If you need an Android unity aar plugin create an issue with feature request or mail us at arupakamanstudios[AT]gmail[DOT]com.
25+
26+
### I prefer a star than a cup of coffee
27+
28+
## Licensing
29+
30+
This project is licensed under the [MIT License.](LICENSE)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Unity Android SDK Plugins Basic Utils
2+
3+
This plugin provides basic Android util functions.
4+
5+
## Plugin Functions/Features :
6+
7+
- Show Android Toast UI/Popup (Short/Long)
8+
- Check if device has Internet connection
9+
- Check if device is connected to a WiFi
10+
- Check if WiFi is enabled on device
11+
- Check if Hotspot is enabled on device
12+
- Check if Bluetooth is enabled on device
13+
- Check if Developer Mode (USB debugging) is enabled
14+
- Check if Device is Rooted
15+
- Check if Device is Rooted or has any harmful app installed
16+
- Check if Location Service (GPS) is enabled
17+
- Get Android Device Id (Settings.Secure.ANDROID_ID or SSAID)
18+
- Get Current Device Battery Percentage
19+
20+
## Plugin Usage :
21+
22+
In your unity project, you can use these plugins in your C# scripts.
23+
24+
### Common code required to access all functions
25+
26+
```
27+
const string pluginName = "com.arupakaman.pluginbasicutils.unity.UnityUtils"; // Constant of util static class location
28+
29+
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
30+
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); // jo will be used for Context param
31+
AndroidJavaClass ajc = new AndroidJavaClass(pluginName); // ajc will be used to access UnityUtils class
32+
```
33+
34+
### To show Android Toast UI/Popup (Short/Long)
35+
36+
```
37+
ajc.CallStatic("toast", jo, "Hello Unity World!"); // toast is function name to show the Toast
38+
ajc.CallStatic("toastLong", jo, "Hello Unity World!"); // for long toast
39+
```
40+
41+
### To check boolean returning functions
42+
43+
```
44+
bool isNetConnected = ajc.CallStatic<bool>("isNetConnected", jo);
45+
bool isWifiConnected = ajc.CallStatic<bool>("isWifiConnected", jo);
46+
bool isWifiEnabled = ajc.CallStatic<bool>("isWifiEnabled", jo);
47+
bool isHotspotEnabled = ajc.CallStatic<bool>("isHotspotEnabled", jo);
48+
bool isBluetoothEnabled = ajc.CallStatic<bool>("isBluetoothEnabled", jo);
49+
bool isDeveloperModeEnabled = ajc.CallStatic<bool>("isDeveloperModeEnabled", jo);
50+
bool isRooted = ajc.CallStatic<bool>("isRooted", jo);
51+
bool isRootedOrHarmfulAppsInstalled = ajc.CallStatic<bool>("isRootedOrHarmfulAppsInstalled", jo);
52+
bool isGpsEnabled = ajc.CallStatic<bool>("isGpsEnabled", jo);
53+
```
54+
55+
### To get Android Device ID
56+
57+
```
58+
string androidDeviceId = ajc.CallStatic<string>("getAndroidDeviceId", jo);
59+
```
60+
61+
### Current Device Battery Percentage
62+
63+
```
64+
int batteryPercentage = ajc.CallStatic<int>("getBatteryPercentage", jo);
65+
```
66+
67+
### I prefer a star than a cup of coffee

0 commit comments

Comments
 (0)