initial push of android app and bt server. these are used to make a remote usable via phone
This commit is contained in:
18
NotVPR_Remote/Platforms/Android/AndroidManifest.xml
Normal file
18
NotVPR_Remote/Platforms/Android/AndroidManifest.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yourcompany.shadowstreamremote"
|
||||
android:versionCode="1"
|
||||
android:versionName="V0.1">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<application android:allowBackup="true"
|
||||
android:supportsRtl="true"
|
||||
android:label="ShadowStreamRemote">
|
||||
</application>
|
||||
</manifest>
|
47
NotVPR_Remote/Platforms/Android/MainActivity.cs
Normal file
47
NotVPR_Remote/Platforms/Android/MainActivity.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android;
|
||||
using AndroidX.Core.App;
|
||||
using AndroidX.Core.Content;
|
||||
|
||||
namespace NotVPR_Remote
|
||||
{
|
||||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode |
|
||||
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
const int RequestBluetoothPermissionsId = 1000;
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.S)
|
||||
{
|
||||
string[] permissions =
|
||||
{
|
||||
Manifest.Permission.BluetoothScan,
|
||||
Manifest.Permission.BluetoothConnect,
|
||||
Manifest.Permission.AccessFineLocation // Needed for scanning on some devices
|
||||
};
|
||||
|
||||
if (!HasPermissions(permissions))
|
||||
{
|
||||
ActivityCompat.RequestPermissions(this, permissions, RequestBluetoothPermissionsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool HasPermissions(string[] permissions)
|
||||
{
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if (ContextCompat.CheckSelfPermission(this, permission) != Permission.Granted)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
16
NotVPR_Remote/Platforms/Android/MainApplication.cs
Normal file
16
NotVPR_Remote/Platforms/Android/MainApplication.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace NotVPR_Remote
|
||||
{
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#512BD4</color>
|
||||
<color name="colorPrimaryDark">#2B0B98</color>
|
||||
<color name="colorAccent">#2B0B98</color>
|
||||
</resources>
|
Reference in New Issue
Block a user