Closed james-cohen closed 4 years ago
@james-cohen There's a nuanced step in Android that needs to happen before you can provision wallet. You need to grant External Storage write permissions on the android app. Here's how OSMA has it done.
Alternatively, you can try modifying where default wallet path is stored
new WalletConfiguration.WalletStorageConfiguration
{
Path = Path.Combine(
path1: FileSystem.AppDataDirectory,
path2: ".indy_client",
path3: "wallets")
}
@tmarkovski That works now! Thank you.
Before this I was using the following code included in my Android MainActivity.cs as per the Indy Xamarin setup instructions:
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
JavaSystem.LoadLibrary("c++_shared");
JavaSystem.LoadLibrary("indy");
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, 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);
}
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
This still gives me a popup to grant permission to Data Storage upon first opening the app but then didn't work. Should it be updated to the method you just provided?
Yes, that documentation is somewhat outdated
I'm trying to run the Xamarin Forms sample on my Samsung Galaxy S10 (Android 10.0 Q - Android API 29) and it builds fine but I repeatedly get the same issue whenever I press 'Provision New Agent':
I have copied the code pretty much word for word (apart from the namespaces) and have installed libindy as per the instructions. The only thing I have changed is the EndpointURI in the AgentOptions setup to direct to the endpoint of the Dockerized .Net Agent demo running on my PC:
However, the issue is replicated regardless of what URI is inserted.
This is using the most up to date versions of all required NuGet packages in Visual Studio 2019 on Windows 10.