teotestbluetooth / TestTeoBluetooth / TestTeoBluetooth.Android / MainActivity.cs @ 91ef3e8c
Historique | Voir | Annoter | Télécharger (1,59 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 TestXamConnections.Services; |
9 |
using TestXamConnections.Droid.Connection; |
10 |
using TestXamConnections.Connection; |
11 |
using TestXamConnections.Helper; |
12 |
using TestBLE.Droid.Helper; |
13 |
using TestXamConnections.Droid.Services; |
14 |
|
15 |
namespace TestXamConnections.Droid |
16 |
{ |
17 |
[Activity(Label = "TestBLE", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )] |
18 |
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity |
19 |
{ |
20 |
protected override void OnCreate(Bundle savedInstanceState) |
21 |
{ |
22 |
base.OnCreate(savedInstanceState); |
23 |
|
24 |
Xamarin.Essentials.Platform.Init(this, savedInstanceState); |
25 |
Forms.Init(this, savedInstanceState); |
26 |
DependencyService.RegisterSingleton<IConnectionServiceProvider>(new ConnectionServiceUpdater()); |
27 |
DependencyService.RegisterSingleton<IBluetoothService>(new BluetoothService()); |
28 |
LoadApplication(new App()); |
29 |
} |
30 |
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) |
31 |
{ |
32 |
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); |
33 |
|
34 |
base.OnRequestPermissionsResult(requestCode, permissions, grantResults); |
35 |
} |
36 |
} |
37 |
} |