I use visual studio 2017. Create new cross-platform app (xamarin) with blank app,xamarin forms,pcl. And i set in project:
target framework: android 6.0
minimum android version android 4.0.3
target android version android 6.0
in emulator avd android 6 and 5.x google x86 it work fine and not working on Android 4.x
What am I doing wrong?
My program will not run on android versions below 5
Web Preview: Xamarin.iOS 11.3 Preview 1 for iOS 11.1, tvOS 11.1, and watchOS 4.1 SDK bindings
Please see https://releases.xamarin.com/preview-xcode-9-1-beta-2-ios-11-1-support-preview-1 for the details about this release, including installation instructions and links to the downloads and release notes.
These are preview builds to allow Xamarin developers to start trying the new features available from Apple in Xcode 9.1 beta 2. Any bug reports about the new Xamarin bindings are much appreciated!
File a bug report against Xamarin.iOS 11.3 if you see any problematic behavior in this preview Xamarin.iOS version that you wish to report.
Comment in this forum thread if for example:
- You notice an error in the Release Blog post.
- You have trouble downloading one of the installer packages.
Is IsolatedStorage Supported?
I'm getting a runtime error with isolated storage in one place, and a compile time error regarding the same problem on another project. This is in UWP:
https://stackoverflow.com/questions/46803869/could-not-load-file-or-assembly-system-runtime-handles-xamarin-uwp
But, this is not my question. Someone said "As far as I know IsolatedStorage is not supported in Xamarin apps.". Is this true? Since when?
This article makes me a little nervous:
https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_the_file_system/
We have been using IsolatedStorage since the beginning. IsolatedStorage is a perfect layer that sits over the the top of all platforms: Silverlight, iOS, Android, and UWP. It has been working well with the exception of one bug. If we need to write platforms specific code, it will take forever to get this right. We would have to essentially rewrite the IsolatedStorage library for ourselves.
Is IsolatedStorage supported or not?
How can I Access an already existing SQLite database in mono for android
I'm fairly new to mono for android and Xamarin Studio and I'm currently working on a project where the application I'm creating needs to include a database. I've got no problems so far creating my own SQLite database from my application and accessing it is not a problem either. The problem for me is accessing an already existing database that I've included in the assets of the application.
I've seen many examples of solutions online where this is done by copying the database to the /files folder and then used something called SQLiteOpenHelper, which seems like a good solution. However, they've all been using Java so far and thus those solutions doesn't really work for me.
Could anyone please give me som instructions about how to do this in mono? Or if you now other ways to solve the problem show me how to do those?
Thank you in advance
Flip an SKPath
I'm using slightly modified resize code from the DrawXamagon example in my application. However, on resize the everything is flipped. I would like to either flip it back or prevent it from flipping in the first place. Here is my resize code:
private static void ResizePath(SKPath buildingPath, IEnumerable<Room> rooms)
{
var info = new SKImageInfo(512, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
var drawSpaceRect = SKRect.Create(info.Size);
//I need to find the size of the path
var buildingPathRect = buildingPath.TightBounds;
//I want to find the largest rectangle that can fit on my canvas maintaining the path's aspect ratio
var sketchRect = drawSpaceRect.AspectFit(buildingPathRect.Size);
//Now I need to transform the path to draw within the sketchRect
//First translate original path to its own origin
var firstTranslateM = SKMatrix.MakeTranslation(-buildingPathRect.Left, -buildingPathRect.Top);
//Next handle scaling. Since I maintained aspect ratio, I should be able to use either
//width or height to figure out scaling factor
var scalingFactor = sketchRect.Width/buildingPathRect.Width;
var scaleM = SKMatrix.MakeScale(scalingFactor, scalingFactor);
//Next I need to handle translation so path is centered on canvas
var secondTranslateM = SKMatrix.MakeTranslation(sketchRect.Left, sketchRect.Top);
//Finally I need to handle transforming the path to rotate 180 degrees
var rotationMatrix = SKMatrix.MakeRotationDegrees(180, sketchRect.MidX, sketchRect.MidY);
//Now combine the translation, scaling, and rotation into a single matrix by matrix multiplication/concatentation
var transformM = SKMatrix.MakeIdentity();
SKMatrix.PostConcat(ref transformM, firstTranslateM);
SKMatrix.PostConcat(ref transformM, scaleM);
SKMatrix.PostConcat(ref transformM, secondTranslateM);
SKMatrix.PostConcat(ref transformM, rotationMatrix);
//Now apply the transform to the path
foreach (var r in rooms)
{
r.Path.Transform(transformM);
}
}
Device.StartTimer async
Hi,
Is there any trick to use Device.StartTimer with async?
Device.StartTimer(TimeSpan.FromMinutes(1), async () =>
{
await DisplayAlert("","","");
}
It doesn't compile: Cannot convert async lambda to delegate type Func
Any help?
Android N sqlite-net-pcl issue
We started supporting Android N recently and everytime the app boots up we are getting the following dialog:
"Detected problems with app native libraries(please consult log for details): libmonosgen-32bit-2.0.so: unauthorized access to "/system/lib/libsqlite.so""
I have researched the issue and the general consensus was to update the sqlite plugins so that they use the Android approved way of accessing sqlite.
In my Android project I have the following references:
Sqlite-net 1.4.118
SqlitePCLRaw.batteries_green 1.1.8
SqlitePCLRaw.batteries_v2 1.1.8
SqlitePCLRaw.core 1.1.8
SqlitePCLRaw.lib.e_sqlite3 1.1.8
SqlitePCLRaw.provider.e_sqlite3 1.1.8
Microsoft.Data.Sqlite 1.1.1
In a second project I have the following references:
Sqlite-net-pcl 1.4.118
Microsoft.Data.Sqlite 1.1.1
Any ideas on the best way to get around this?
Splash Screen Image is occupying the entire screen
Hi Devs, I´m new to Xamarin and I´m trying to do a Splash Screen. The Splash Screen is working fine, the problem is that the image is occupying the entire screen. Here´s the code:
Splash_Screen.xml
<?xml version="1.0" encoding="utf-8" ?> <resources> <style name="Portal_RNT_App.Theme" parent="android:Theme"> <item name="android:windowBackground"> @drawable/logo </item> <item name="android:windowNoTitle"> true </item> </style> </resources>
Splash_Screen.cs
` [Activity(Theme = "@style/App.Theme", MainLauncher = true, NoHistory = true)]
public class Splash_Screen : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your application here
Thread.Sleep(4000);
StartActivity(typeof(MainActivity));
}
}`
Does anybody knows how to solve this problem?
Best Regards
How to logout using Azure ADAL ?
I am using Azure active directory authentication(ADAL library) in my Xamarin forms app.I want to have the logout functionality in my app.I cleared the token cache but somehow I am still getting a valid token and not the login page.Also if I have logged in with one user,I am unable to allow login for another user.As we are always getting the token associated with the first user.
Mysql or MSSql from Xamarin Forms
I'm building an cross-platform app with Xamarin Forms. Im having a lot of trouble loading packages to access databases.
I don't seem to be able to install either System.Data.SqlClient or MySQL...... or Pomelo.
Seems to be something to do with .NetPortable, and profile 259.
Example:
Could not install package 'Pomelo.Data.MySql 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Time Elapsed: 00:00:16.2248820
========== Finished ==========
Help? What am I doing wrong?
Xamarin Forms + VS2017 + NETStandard: XAML and code behind are not grouped
I added two pages by "Add\New Item" and choosing "Content Page".
The XAML and code behind are not grouped, the .cs should depend on the XAML.
Is this a known issue in VS 2017? I spent a lot of time updating tooling only to discover this isn't working.... I hope it's a problem on my local installation.
Can someone please confirm?
Also, is there a list of known issues related to NETStandard support for Xamarin Forms in VS2017?
Image upload using Multipart form in Xamarin.Forms
How are you?
I tried to upload photo to server using multipart form in xamarin pcl project.
I used many open sources, but got no luck.
Can someone please share source code which is working well ?
Thanks,
Jakob
Cannot upload new app version
Hi we are trying to upload a new version of our app to Google Play. When we attempt to upload the archive we receive the error: 'Devices with version 18 of this app target SDK 24 and would be upgraded to version 19 which targets SDK 0. This is forbidden as you cannot upgrade away from M permissions.'
The target framework is set to 6.0 Marshmallow with the Minimum Android version and target android version both set as: 'Use Compile using SDK version'. Having these settings allows us to run the app on our device in release mode, but changing the target versions to specific targets causes the app to crash as soon as it deploys. Any help would be greatly appreciated!
Automatically select all text on focus in Entry,Editor,Label
How to automatically select all text on focus in entry ?
Message "Unfortunately, AppName has stopped" at first launch application
Hi everyone!
I build release signed apk of my android app. There is no problem when I install package on my phone with command
adb install package.apk
But after the successful publication of the package on Google Play and install app from there, the following problem happens:
- at first launch application I see error "Unfortunately, AppName has stopped", but the application continues to work
- there is no error at second launch
- there is crash report in my google play console:
java.lang.UnsatisfiedLinkError:
at md5e03b4490aea638ea6c88558d50493b43.MainApplication.n_onCreate (Native Method)
at md5e03b4490aea638ea6c88558d50493b43.MainApplication.onCreate (MainApplication.java:34)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:4806)
at android.app.ActivityThread.access$1600 (ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1452)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:234)
at android.app.ActivityThread.main (ActivityThread.java:5526)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
(but I'm not sure that these errors are interrelated)
Does anyone have any idea why this happened?
About export pkcs12 from keychain
When i export pkcs12 from keychain in iOS, I have 2 ways to deal with it, but there are some problems in these 2 ways.
I need your help, thank you.
one: use xamarin.ios
string aesEncryptSN = "abc1234444"
SecRecord sec = new SecRecord(SecKind.Key)
{
ApplicationLabel = aesEncryptSN,
};
SecRecord result = SecKeyChain.QueryAsRecord(sec, out code);
if (result != null)
{
return result.ValueData.ToArray();
??????????????
}
From this way I can successfully export pkcs12, but the password was the original password , I don't know how to use a new simple password to replace it and re-generate a PKCS12 file and export it ?
two: use .net
string aesEncryptSN = "abc1234444"
SecRecord sec = new SecRecord(SecKind.Key)
{
ApplicationLabel = aesEncryptSN,
};
SecRecord result = SecKeyChain.QueryAsRecord(sec, out code);
if (result != null)
{
bytes = result.ValueData.ToArray();
X509Certificate2Collection col = new X509Certificate2Collection();
col.Import(bytes , originalPassword, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
return col.Export(X509ContentType.Pfx, newPassWord);
}
From this way I can successfully export pkcs12 and replace the original Password use new password.
But the pkcs12 is missing certificate chains.
It's sucess in windows system when use the same way, the Pkcs12 contains certificate chains.
My project has been developed for more than 6 months, and has been successfully released. This problem has been bothering me, and I sincerely hope that you can help me.
thanks very much.
Control ContentView visibility from ViewModel
App tour for Xamarin forms app
Hi Developers,
We want to implement the app tour functionality in our Forms app. Please share some references on how to implement this.
Thanks!
Found conflicts between different versions of the same dependent assembly that could not be resolved
Signed up to Xamarin University and am walking through course XAM110 (slide 18 of 63) -- where you get to the point where you build each project. I cannot build the IOS project because I do not (yet) have access to a Mac. When I build the "MyTunes.Droid" project, I get the following warning:
Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. MyTunes.Droid
The emulator starts and is displayed, but I get nothing -- just a blank (black) surface? Since I am basically a monkey at this point (simply copying and pasting code and following directions, without knowing what 99% of this code does) -- any suggestions?
Thanks in advance.
ApkFile or InstalledApp has not been configured.
I Visual Studio 2015 everything was ok, but since I switched to Visual Studio 2017, I can't run any UI tests locally anymore.
Instead, I'm getting the "ApkFile or InstalledApp has not been configured." error
How to fix that?
I make a call like this - ConfigureApp.Android.StartApp();