teotestbluetooth / TestBLE / TestBLE.Android / MainActivity.cs @ 3c62e059
Historique | Voir | Annoter | Télécharger (1,314 ko)
1 |
using System; |
---|---|
2 |
|
3 |
using Android.App; |
4 |
using Android.Content.PM; |
5 |
using Android.Runtime; |
6 |
using Android.OS; |
7 |
using Xamarin.Forms; |
8 |
using TestBLE.Services; |
9 |
|
10 |
namespace TestBLE.Droid |
11 |
{ |
12 |
[Activity(Label = "TestBLE", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )] |
13 |
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity |
14 |
{ |
15 |
protected override void OnCreate(Bundle savedInstanceState) |
16 |
{ |
17 |
base.OnCreate(savedInstanceState); |
18 |
|
19 |
Xamarin.Essentials.Platform.Init(this, savedInstanceState); |
20 |
global::Xamarin.Forms.Forms.Init(this, savedInstanceState); |
21 |
DependencyService.RegisterSingleton<IBluetoothService>(new Services.BluetoothService()); |
22 |
LoadApplication(new App()); |
23 |
} |
24 |
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) |
25 |
{ |
26 |
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); |
27 |
|
28 |
base.OnRequestPermissionsResult(requestCode, permissions, grantResults); |
29 |
} |
30 |
} |
31 |
} |