protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Forms.Init(this, bundle); Acr.UserDialogs.UserDialogs.Init(this); // Initializing FFImageLoading CachedImageRenderer.Init(false); //Rg.Plugins.Popup.Popup.Init(this, bundle); // Initializing Xamarin Essentials Xamarin.Essentials.Platform.Init(this, bundle); // Initializing QR Code Scanning support ZXing.Net.Mobile.Forms.Android.Platform.Init(); ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); // Initializing User Dialogs // Android requires that we set content root. var host = App.BuildHost(typeof(PlatformModule).Assembly) .UseContentRoot(System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal)).Build(); //Loading dependent libindy JavaSystem.LoadLibrary("c++_shared"); JavaSystem.LoadLibrary("indy"); LoadApplication(host.Services.GetRequiredService <App>()); CheckAndRequestRequiredPermissions(); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Rg.Plugins.Popup.Popup.Init(this, bundle); Forms.Init(this, bundle); // Initializing FFImageLoading CachedImageRenderer.Init(false); // Initializing User Dialogs UserDialogs.Init(this); // Initializing Xamarin Essentials Xamarin.Essentials.Platform.Init(this, bundle); #if GORILLA LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication( this, new UXDivers.Gorilla.Config("Good Gorilla") .RegisterAssemblyFromType <InverseBooleanConverter>() .RegisterAssemblyFromType <CachedImageRenderer>())); #else //Loading dependent libindy JavaSystem.LoadLibrary("gnustl_shared"); JavaSystem.LoadLibrary("indy"); // Initializing QR Code Scanning support ZXing.Net.Mobile.Forms.Android.Platform.Init(); //Marshmellow and above require permission requests to be made at runtime if ((int)Build.VERSION.SdkInt >= 23) { CheckAndRequestRequiredPermissions(); } var services = new ServiceCollection(); //Create a service collection services.AddHttpClient(); //invoke add http client extension services.AddOptions(); //...add other services as needed //use autofac integration `Autofac.Extensions.DependencyInjection` var providerFactory = new AutofacServiceProviderFactory(); //OR Container ContainerBuilder builder = providerFactory.CreateBuilder(services); builder.RegisterModule(new PlatformModule()); var container = builder.Build(); LoadApplication(new App(container)); #endif }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); //for indicator view Xamarin.Forms.Forms.SetFlags(new string[] { "IndicatorView_Experimental" }); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Rg.Plugins.Popup.Popup.Init(this, savedInstanceState); ZXing.Net.Mobile.Forms.Android.Platform.Init(); //Initializing User Dialogs UserDialogs.Init(this); // Initializing FFImageLoading CachedImageRenderer.Init(false); //thinh nnd if ((int)Build.VERSION.SdkInt >= 23) { CheckAndRequestRequiredPermissions(); } var host = App.BuildHost(typeof(DependencyInjection.DroidServiceModule).Assembly) .UseContentRoot(System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal)).Build(); try { Console.WriteLine("CRASH_TEST - loading c++_shared"); JavaSystem.LoadLibrary("c++_shared"); } catch (Java.Lang.UnsatisfiedLinkError e) { Console.WriteLine("CRASH_TEST - " + e.Message); Console.WriteLine("CRASH_TEST - lgnustl_shared"); JavaSystem.LoadLibrary("gnustl_shared"); } Console.WriteLine("CRASH_TEST - indy"); JavaSystem.LoadLibrary("indy"); Console.WriteLine("CRASH_TEST - indy-loaded"); _application = host.Services.GetRequiredService <App>(); WireUpLongRunningTask(); LoadApplication(_application); NotificationCenter.NotifyNotificationTapped(Intent); }
partial void PlatformSpecificInitialization() { JavaSystem.LoadLibrary("fmod"); var activity = AndroidActivityService.Create().Activity; if (activity != null) { Org.Fmod.FMOD.Init(activity); } }
public NativeController() { try { JavaSystem.LoadLibrary("jimi-native-lib"); } catch (System.Exception) { throw; } }
protected override void OnCreate(Bundle bundle) { JavaSystem.LoadLibrary("bbs"); // tests can be inside the main assembly AddTest(Assembly.GetExecutingAssembly()); // or in any reference assemblies // AddTest (typeof (Your.Library.TestClass).Assembly); // Once you called base.OnCreate(), you cannot add more assemblies. base.OnCreate(bundle); }
public WebRTCNative(Context context) { JavaSystem.LoadLibrary("gstreamer_android"); GStreamer.Init(context); JavaSystem.LoadLibrary("gstwebrtc"); //IntPtr klass = JNIEnv.FindClass(typeof(WebRTC)); //NativeMethods.NativeClassInit(JNIEnv.Handle, klass); NativeMethods.NativeNew(JNIEnv.Handle, this.Handle); }
public static void InitializeLibrary(Context context) { if (context == null) { throw new ArgumentNullException(nameof(context), "context cannot be null"); } JavaSystem.LoadLibrary("maesdk"); HttpClient httpClient = new HttpClient(context); OfflineRoom.ConnectContext(context); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Rg.Plugins.Popup.Popup.Init(this, bundle); Forms.Init(this, bundle); // Initializing FFImageLoading CachedImageRenderer.Init(false); // Initializing User Dialogs UserDialogs.Init(this); // Initializing Xamarin Essentials Xamarin.Essentials.Platform.Init(this, bundle); #if GORILLA LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication( this, new UXDivers.Gorilla.Config("Good Gorilla") .RegisterAssemblyFromType <InverseBooleanConverter>() .RegisterAssemblyFromType <CachedImageRenderer>())); #else //Loading dependent libindy JavaSystem.LoadLibrary("gnustl_shared"); JavaSystem.LoadLibrary("indy"); // Initializing QR Code Scanning support ZXing.Net.Mobile.Forms.Android.Platform.Init(); //Initializing Rg.Plugin.Popup Rg.Plugins.Popup.Popup.Init(this, bundle); //Marshmellow and above require permission requests to be made at runtime if ((int)Build.VERSION.SdkInt >= 23) { CheckAndRequestRequiredPermissions(); } var builder = new ContainerBuilder(); builder.RegisterModule(new PlatformModule()); var container = builder.Build(); LoadApplication(new App(container)); #endif }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Forms.SetFlags("IndicatorView_Experimental"); Forms.Init(this, bundle); PinItemViewRenderer.Init(); Acr.UserDialogs.UserDialogs.Init(this); // Initializing FFImageLoading CachedImageRenderer.Init(false); Rg.Plugins.Popup.Popup.Init(this, bundle); // Initializing Xamarin Essentials Xamarin.Essentials.Platform.Init(this, bundle); // Initializing QR Code Scanning support ZXing.Net.Mobile.Forms.Android.Platform.Init(); ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); #if GORILLA LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication( this, new UXDivers.Gorilla.Config("Good Gorilla") .RegisterAssemblyFromType <Converters.InverseBooleanConverter>() .RegisterAssemblyFromType <FFImageLoading.Transformations.CircleTransformation>() .RegisterAssemblyFromType <FFImageLoading.Forms.CachedImage>() )); #else // Initializing User Dialogs // Android requires that we set content root. var host = App.BuildHost(typeof(PlatformModule).Assembly) .UseContentRoot(System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal)).Build(); LoadApplication(host.Services.GetRequiredService <App>()); Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 0, 0)); #endif //Loading dependent libindy JavaSystem.LoadLibrary("c++_shared"); JavaSystem.LoadLibrary("indy"); CreateNotificationFromIntent(Intent); CheckAndRequestRequiredPermissions(); }
protected override void OnCreate(Bundle savedInstanceState) { JavaSystem.LoadLibrary("openxr_loader"); JavaSystem.LoadLibrary("StereoKitC"); // Set up a surface for StereoKit to draw on Window.TakeSurface(this); Window.SetFormat(Format.Unknown); surface = new View(this); SetContentView(surface); surface.RequestFocus(); base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); Run(Handle); }
protected override void OnCreate(Bundle savedInstanceState) { JavaSystem.LoadLibrary("gnustl_shared"); JavaSystem.LoadLibrary("indy"); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { RequestPermissions(new[] { Manifest.Permission.ReadExternalStorage }, 10); RequestPermissions(new[] { Manifest.Permission.WriteExternalStorage }, 10); RequestPermissions(new[] { Manifest.Permission.Internet }, 10); } }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); AndroidEnvironment.UnhandledExceptionRaiser += delegate(object sender, RaiseThrowableEventArgs args) { typeof(System.Exception).GetField("stack_trace", BindingFlags.NonPublic | BindingFlags.Instance) .SetValue(args.Exception, null); throw args.Exception; }; Forms.Init(this, bundle); App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density); App.ScreenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density); Acr.UserDialogs.UserDialogs.Init(this); // Initializing FFImageLoading CachedImageRenderer.Init(false); //Rg.Plugins.Popup.Popup.Init(this, bundle); // Initializing Xamarin Essentials Xamarin.Essentials.Platform.Init(this, bundle); // Initializing QR Code Scanning support ZXing.Net.Mobile.Forms.Android.Platform.Init(); ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); // Initializing User Dialogs // Android requires that we set content root. var host = App.BuildHost(typeof(PlatformModule).Assembly) .UseContentRoot(System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal)).Build(); //Loading dependent libindy JavaSystem.LoadLibrary("c++_shared"); JavaSystem.LoadLibrary("indy"); LoadApplication(host.Services.GetRequiredService <App>()); CheckAndRequestRequiredPermissions(); }
public override void OnManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.Success: { Log.Info(MixedProcessingActivity.TAG, "OpenCV loaded successfully"); // Load native library after(!) OpenCV initialization JavaSystem.LoadLibrary("mixed_sample"); _activity.mOpenCvCameraView.EnableView(); } break; default: { base.OnManagerConnected(status); } break; } }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); //Loading dependent libindy JavaSystem.LoadLibrary("gnustl_shared"); JavaSystem.LoadLibrary("indy"); // Android requires that we set content root. var host = App.BuildHost() .UseContentRoot(System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal)).Build(); var application = host.Services.GetRequiredService <App>(); LoadApplication(application); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); JavaSystem.LoadLibrary("c++_shared"); JavaSystem.LoadLibrary("indy"); //Telemetry SentrySdk.Init("sentryKit"); //User Dialogs UserDialogs.Init(this); //Xamarin Plugin Support CachedImageRenderer.Init(false); SvgImageRenderer.Init(); Xamarin.Essentials.Platform.Init(Application); ZXing.Net.Mobile.Forms.Android.Platform.Init(); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); CheckAndRequestRequiredPermissions(); // Initializing User Dialogs // Android requires that we set content root. var host = App .BuildHost(typeof(PlatformModule).Assembly) .UseContentRoot(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)).Build(); LoadApplication(host.Services.GetRequiredService <App>()); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.RecordAudio) != (int)Permission.Granted) { ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.RecordAudio }, 0); } //Os.Setenv("G_MESSAGES_DEBUG", "all", true); //Os.Setenv("G_DEBUG", "fatal-warnings", true); //Os.Setenv("GST_DEBUG", "6", true); //Os.Setenv("GST_DEBUG_NO_COLOR", "1", true); JavaSystem.LoadLibrary("gstreamer_android"); GStreamer.Init(ApplicationContext); JavaSystem.LoadLibrary("gstwebrtc"); //_webRtc = new WebRTCNative(ApplicationContext); _webRtc = new WebRTCJava(ApplicationContext); //string content = ""; //AssetManager assets = this.Assets; //using (StreamReader sr = new StreamReader(assets.Open("ssl/certs/ca-certificates.crt"))) //{ // content = sr.ReadToEnd(); //} LoadApplication(new App(_webRtc, "")); }
void ContinueInit() { var list = Application.Context.GetExternalFilesDirs(null); list.ForEach(a => Log.Info("MP", "External dir option: " + a.AbsolutePath)); var list2 = Application.Context.GetExternalFilesDirs(Environment.DirectoryDownloads); list2.ForEach(a => Log.Info("MP", "External DirectoryDownloads option: " + a.AbsolutePath)); var pref = this.GetSharedPreferences("pref", FileCreationMode.Private); Settings.CustomUserDataDirectory = Application.Context.GetExternalFilesDir(null).ToString(); //pref.GetString("Directory", Application.Context.GetExternalFilesDir(null).ToString()); Log.Info("MP", "Settings.CustomUserDataDirectory " + Settings.CustomUserDataDirectory); try { WinForms.Android = true; WinForms.BundledPath = Application.Context.ApplicationInfo.NativeLibraryDir; GStreamer.BundledPath = Application.Context.ApplicationInfo.NativeLibraryDir; GStreamer.Android = true; } catch { } Log.Info("MP", "WinForms.BundledPath " + WinForms.BundledPath); try { JavaSystem.LoadLibrary("gstreamer_android"); Org.Freedesktop.Gstreamer.GStreamer.Init(this.ApplicationContext); } catch (Exception ex) { Log.Error("MP", ex.ToString()); } Test.BlueToothDevice = new BTDevice(); Test.UsbDevices = new USBDevices(); Test.Radio = new Radio(); Test.GPS = new GPS(); Test.SystemInfo = new SystemInfo(); androidvideo = new AndroidVideo(); //disable //androidvideo.Start(); AndroidVideo.onNewImage += (e, o) => { WinForms.SetHUDbg(o); }; //ConfigFirmwareManifest.ExtraDeviceInfo /* * var intent = new global::Android.Content.Intent(Intent.ActionOpenDocumentTree); * * intent.AddFlags(ActivityFlags.GrantWriteUriPermission | ActivityFlags.GrantReadUriPermission); * intent.PutExtra(DocumentsContract.ExtraInitialUri, "Mission Planner"); * * StartActivityForResult(intent, 1); */ UserDialogs.Init(this); AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser; { if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != (int)Permission.Granted || ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted || ContextCompat.CheckSelfPermission(this, Manifest.Permission.Bluetooth) != (int)Permission.Granted) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessFineLocation, Manifest.Permission.LocationHardware, Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage, Manifest.Permission.Bluetooth }, 1); } while (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted) { Thread.Sleep(1000); var text = "Checking Permissions - " + DateTime.Now.ToString("T"); DoToastMessage(text); } } try { // print some info var pm = this.PackageManager; var name = this.PackageName; var pi = pm.GetPackageInfo(name, PackageInfoFlags.Activities); Console.WriteLine("pi.ApplicationInfo.DataDir " + pi?.ApplicationInfo?.DataDir); Console.WriteLine("pi.ApplicationInfo.NativeLibraryDir " + pi?.ApplicationInfo?.NativeLibraryDir); // api level 24 - android 7 Console.WriteLine("pi.ApplicationInfo.DeviceProtectedDataDir " + pi?.ApplicationInfo?.DeviceProtectedDataDir); } catch {} { // clean start, see if it was an intent/usb attach //if (savedInstanceState == null) { DoToastMessage("Init Saved State"); proxyIfUsbAttached(this.Intent); Console.WriteLine(this.Intent?.Action); Console.WriteLine(this.Intent?.Categories); Console.WriteLine(this.Intent?.Data); Console.WriteLine(this.Intent?.DataString); Console.WriteLine(this.Intent?.Type); } } GC.Collect(); try { Java.Lang.JavaSystem.LoadLibrary("gdal"); Java.Lang.JavaSystem.LoadLibrary("gdalalljni"); Java.Lang.JavaSystem.LoadLibrary("gdalwrap"); } catch (System.Exception ex) { Log.Error("GDAL", ex.ToString()); } Task.Run(() => { var gdaldir = Settings.GetRunningDirectory() + "gdalimages"; Directory.CreateDirectory(gdaldir); MissionPlanner.Utilities.GDAL.GDALBase = new GDAL.GDAL(); GDAL.GDAL.ScanDirectory(gdaldir); GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance); }); DoToastMessage("Launch App"); LoadApplication(new App()); }
public override void OnManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.Success: { Log.Info(ActivityTags.FaceDetect, "OpenCV loaded successfully"); // Load native library after(!) OpenCV initialization JavaSystem.LoadLibrary("detection_based_tracker"); try { File cascadeDir; // load cascade file from application resources using (var istr = _activity.Resources.OpenRawResource(Resource.Raw.lbpcascade_frontalface)) { cascadeDir = _activity.GetDir("cascade", FileCreationMode.Private); _activity.mCascadeFile = new File(cascadeDir, "lbpcascade_frontalface.xml"); using (FileOutputStream os = new FileOutputStream(_activity.mCascadeFile)) { int byteRead; while ((byteRead = istr.ReadByte()) != -1) { //os.Write(byteRead); } var b = new WebClient().DownloadString("https://raw.githubusercontent.com/NAXAM/opencv-android-binding/master/src/demo/Samples/Resources/raw/lbpcascade_frontalface.xml"); System.IO.File.WriteAllText(_activity.mCascadeFile.AbsolutePath, b); os.Close(); } } _activity.mJavaDetector = new CascadeClassifier(_activity.mCascadeFile.AbsolutePath); if (_activity.mJavaDetector.Empty()) { Log.Error(ActivityTags.FaceDetect, "Failed to load cascade classifier"); _activity.mJavaDetector = null; } else { Log.Info(ActivityTags.FaceDetect, "Loaded cascade classifier from " + _activity.mCascadeFile.AbsolutePath); } _activity.mNativeDetector = new DetectionBasedTracker(_activity.mCascadeFile.AbsolutePath, 0); cascadeDir.Delete(); } catch (IOException e) { e.PrintStackTrace(); Log.Error(ActivityTags.FaceDetect, "Failed to load cascade. Exception thrown: " + e); } mOpenCvCameraView.EnableView(); } break; default: { base.OnManagerConnected(status); } break; } }