I am working on a cross platform application that needs to keep the flashlight always ON while the camera is operated. Is there any particular way to do it?
I tried using the CrossLamp.Current.TurnOn(); but it throws error as the two plugins are not working together.
Related
I have hosted my model offline file on a local server and I am connected to the same server everything is accessible to me via android phone.
I have create a sample project where the forge render offline model file which works smoothly on chrome browser of my laptop but on my Xamarin form webview and chrome browser the model render with lags as my model has too many details and nodes, I cannot even perform a simple zoom in zoom out functionality.
Now same thing when I am running on Ios(safari browser) this works smooth and without any issue.
I want to understand is they any such setting which effects chrome browser or native browser of android which loads model with lag
I have tried all the possible solutions available on google
1.I have implemented this in xamarin forms custom webview renderer and gave all the required resource that I can
here are the few settings
var mWebView = new global::Android.Webkit.WebView(MainActivity.Main.ApplicationContext);
WebSettings settings = mWebView.Settings;
settings.JavaScriptEnabled = true;
settings.LoadWithOverviewMode = true;
settings.UseWideViewPort = true;
settings.SupportZoom();
settings.BuiltInZoomControls = false;
settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
settings.CacheMode = CacheModes.CacheElseNetwork;
settings.DomStorageEnabled = true;
mWebView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
mWebView.ScrollbarFadingEnabled = true;
mWebView.SetLayerType(LayerType.Hardware, null);
SetNativeControl(mWebView);
2.Added hardware acceleration in manifest also added heap flag to true in manifest
3.followed this too for autodesk memory limit {https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/viewer_basics/memory-limit/}
4.I tested above solution with firefox and it works smoothly I am not sure what different they are doing to render this files
can any one help me what should I try to solve this issue
My device is medium end with 8gb Ram and 128gb internal space I am testing on 2 devices (samsung m40 and one plus 7t)
Me to same Issue I am Unable To move Model in Android device. I am using the both online and offline Viewers.
I am Using Xamarin Forms Custom WebView Renderer as like Question
Autodesk team reply to us and Petr Broz solution plz
I'm afraid this (running a web application inside a Xamarin WebView) is beyond our area of expertise but I would suggest the following:
try running a vanilla three.js application inside the WebView, with a reasonably complex scene as well (for example, convert one of your Forge models into glTF using https://github.com/petrbroz/forge-convert-utils, and load the glTF)
if the three.js application has similar performance issues, it's most likely an issue on the Xamarin side, and something we won't be able to help with
if the three.js application is working fine, please send us (forge (dot) help (at) autodesk (dot) com) a basic Xamarin project with both Forge Viewer and with Three.js that can demonstrate the performance differences, and we would try and allocate some time for debugging it, and see if there's anything we can do to help
I've been struggling with the APPUriHandler to work correct using Xamarin.Forms for building a multi platform app. I am not getting the AppHandler to work correct using the "Shared pages"
Following https://learn.microsoft.com/en-us/windows/uwp/launch-resume/web-to-app-link i have managed to open the appif i launch the app manual, when using a link I get stuck on the SplashScreen
which throws an error :
Its just when using the handler that it fails. I have identified that if I add a new page on the UWP project, and navigate to that page, it works fine. My problem is using the .Net standard (Old PCL) method as it is using multi platform. Is there a way to get past this or call the LoadApplication a different way from UWP MainPage as that is where it breaks
or anything that can steer me in the right direction?
I am trying to embed an image in Xamarin and was expecting to see a resource Id appear in the properties of the image. It seems to be a problem that I cannot find an answer for. I have updated VS, JDK to 64 bit, updated Xamarin, cleaned rebuilt, restarted. I'm using the latest API (API 27 8.1)
I have checked the Xamarin forum and the VS forums and there is no answer available. In my code-behind I am writing the following:
bgImage.Source = ImageSource.FromResource("FoodSnapApps.Images.steps.jpg");
Obviously it wont work as the resource has no reference.
As always, any help will be greatly appreciated.
As stated here, in Xamarin forms local images must be loaded in the platform specific projects:
Image files can be added to each application project and referenced from Xamarin.Forms shared code. To use a single image across all apps, the same filename must be used on every platform, and it should be a valid Android resource name (ie. only lowercase letters, numerals, the underscore, and the period are allowed).
iOS - The preferred way to manage and support images since iOS 9 is to use Asset Catalog Image Sets, which should contain all of the versions of an image that are necessary to support various devices and scale factors for an application. For more information, see Adding Images to an Asset Catalog Image Set.
Android - Place images in the Resources/drawable directory with Build Action: AndroidResource. High- and low-DPI versions of an image can also be supplied (in appropriately named Resources subdirectories such as drawable-ldpi, drawable-hdpi, and drawable-xhdpi).
Windows Phone - Place images in the application's root directory with Build Action: Content.
Universal Windows Platform (UWP) - Place images in the application's root directory with Build Action: Content.
Then you can access them as follow:
In XAML: <Image Source="waterfront.jpg" />
In C#: var image = new Image { Source = "waterfront.jpg" };
I suggest you to read all that page of documentation to proper handling images in your Xamarin forms project.
HIH
I know it's an old question, but for people who may reach this page on future, code below works for me:
bgImage.Source="resource://FoodSnapApps.Images.steps.jpg"
I am trying to create a project in which picture is taken to upload from mobile camera, but when it is taken with front camera it rotates upside down (especially Android). I have read suggestions to use Exif.PCL nuget package but dont know how to implement the same. Can anybody help me out with this ?
Thanks
Background
I had the same problem in one of my apps. After trying different approaches I've found several problems with current implementations. Generally I use XLabs, which has media picking capabilities.
Issues
First of all it lacked support for scaling and autorotating images after they are taken. That's your question. So, first of all I had to implement some after-processing as soon as the image was picked.
Second, there are problems with Android and Xamarin.Forms due do how Activities are handled in Android. The way it works on Android is you launch CameraActivity or PhotoGalleryActivity which are actually hosted in a different application. Those Activities use substential amount of system memory, and due to this operating system will try to kill non-forground processes, including your app :) Workarround for this was completely implementing photo taking flow inside of my application by creating photo taking activities from scratch. Thus, I will never leave my app, and Android runtime will never kill my application.
Solution
Taking account all of this, I've implement my own flow of Image capturing. You can find the source code HERE. The basic architecture is following:
I've created IImageService, which has methods for picking images from camera or library.
public interface IImageService
{
Task<IImage> GetImageFromLibrary();
Task<IImage> GetImageFromCamera();
}
Then I've implemented this for iOS and Android separately and used dependency injection. For iOS I use XLabs implementation, cause it works as it should there are no problems with it. For Android I've created several activities to support picking images from Camera and Library: CameraActivity, PhotoGaleryActivity, which basically replace the native image picking activities.
After I pick the image I do scaling and rotating procedure. For iOS I've created UIImageToolbox static class which has GetScaledAndRotatedImage method. For Android it's BitmapToolbox static class which has GetScaledAndRotatedBitmap method.
In my sample application I've created ImageViewModel and ImagePage to demonstrate the usage of IImageService. It should be straightforward.
How to use the sample app?
Let me give a small remark. You can use only XLabs implementation for both iOS and Android and just use BitmapToolbox and UIImageToolbox to implement the scaling and rotation. And this is answer to your question. However, if you want your app to be stable on Android you need to go a little bit dipper.
Install all the necessary nuget packages to your Forms, Droid and iOS projects. You can find the packages that are used by sample application in packages.config file of each project
I use MvvmCross Messenger plugin for broadcast messaging, if you have alternative you can easily replace it. But if you want to use it, don't forget to register dependencies in your AppDelegate and MainActivity
DependencyService.Register();
Add necessary classes to your Forms, iOS and Android projects from sample application. You can use Resharper to fix namespaces for you.
For xaml files, if you drug and drop to forms project default build action and Custom Tool are set to wrong values. Thus click the xaml file, select properties set Build Action to Embedded Resource, and Custom Tool to MSBuild:UpdateDesignTimeXaml
For android project add necessary resources from drawable, drawable-xxhdpi, layout and values folders.
In grid_cell_photo_galery_item.axml file fix namespaces. Replace ImageSample.Droid.Views.SquareRelativeLayout by your namespace.
For Android, right click Android project, select properties, go to Android Manifest and add CAMERA, READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
For Android, right click Android project, select properties, go to Advanced and set Max Heap Size to something like 1G, this is needed because PhotoGalaryActivity uses substantial amount of memory to display images and we need an increased heap size.
For iOS, don't forget to add dependency injection for MediaPicker in AppDelegate - DependencyService.Register<MediaPicker>();
That's all.
I try to run :
http://www.smallscreendesign.com/2011/09/29/air-native-extensions-rock/
I downloaded the code and imported the project folder (AndroidExtensions_Demo) in Flash Builder 4.6, changed the air version to 3.1, changed the flex compiler to 4.6 as that is what I’m using and ran it on the device.
However, when I clicked on Send button, I got the error below.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.ssd.ane::AndroidExtensions$/get context()[/Users/anto/git/Android-AIR-Extensions/AndroidExtensions/src/com/ssd/ane/AndroidExtensions.as:158]
at com.ssd.ane::AndroidExtensions$/shareText()[/Users/anto/git/Android-AIR-Extensions/AndroidExtensions/src/com/ssd/ane/AndroidExtensions.as:48]
Is there another way to send SMS with Flex Mobile ?
I want to avoid the manual sending SMS process by pressing "Send" or "Ok" button
The reported exception refers to a failure during the context setup of the ANE. It should be mostly related to project configuration in many different ways.
Make sure you're setting the correct path of the ANE in your project and please consider a full rebuild of the ANE, including the native (Android) code in order to avoid further problems.
Edit:
Unfortunately AIR doesn't provide any native other way to send a SMS save calling the navigateToUrl() using the sms: uri scheme (eg: navigateToUrl("sms:5551234567"); ). This way however the system SMS editor will be shown and you can't specify any body neither.
The only way to send an SMS in a full programmatically way is to write your own ANE and leverage Android APIs in order to get the things done.