Hey all,
im trying to do this tutorial Add layers to a map (offline) | ArcGIS for Developers
I need to tell the apk where the location of the PackageFolder is. When i put it on my device or i use the path from my pc. It will not load the mmpk, when i test the apk.
this is how i write it:
var mapPackageFolder = @"C:\Users\Test\Desktop\XamarinTest\Vegetation Management";
var mapPackageFile = @"SUEWAG VTPK Grundkarte Beschriftung.mmpk";
this is how i tested it, when i put the folder it to my Device
var mapPackageFolder = @"Interner Speicher\XamarianTest";
var mapPackageFile = @"SUEWAG VTPK Grundkarte Beschriftung.mmpk";
do i miss something?
What platform, WPF or UWP? UWP restricts where you could put files.
I think i need to explain more. Im using Visual Studio and Xamarin to create iOS and Android applications. Im working with Windows10.
I dont use UWP and WPF, maybe im using the wrong tutorial???
There is no C: drive on an iOS or Android device, you cannot set a location like you would in Windows with a full path.
The easiest way is to use a Environment.SpecialFolder because this returns the platform specific location.
var mapPackageFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SomeSubfolder", "SomePackageName");
Thanks it helped me, but i got it working with Android.OS.Environment.ExternalStorageDirectory.
But now i get this Error:
Esri.ArcGISRuntime.ArcGISRuntimeException: 'Invalid access: Mobile map package failed to open. Check the archive format is correct, zip file with no compression.'
Are you able to open the file with standard .NET File APIs with that path? Ie File.OpenRead(pathToMmpk) ?
Also make sure you configure your application manifest to read in that location.
With android you can't really package files with the application itself - you can only package assets, and you'd have to "unpack" those files first to a local folder before opening, or downloading it from an online location to that location on first access.