C
C#10mo ago
r2d25551

❔ .NET MAUI GetSystemService returns null

All the calls to GetSystemService return null. Has anyone used this before? Am I doing something wrong?
string[] serviceNames = new string[]
{
"ACCESSIBILITY_SERVICE",
"ACCOUNT_SERVICE",
"ACTIVITY_SERVICE",
"ALARM_SERVICE",
"APP_OPS_SERVICE",
:
};

foreach (string serviceName in serviceNames)
{
Java.Lang.Object? service = Android.App.Application.Context.GetSystemService(serviceName);
:
}
string[] serviceNames = new string[]
{
"ACCESSIBILITY_SERVICE",
"ACCOUNT_SERVICE",
"ACTIVITY_SERVICE",
"ALARM_SERVICE",
"APP_OPS_SERVICE",
:
};

foreach (string serviceName in serviceNames)
{
Java.Lang.Object? service = Android.App.Application.Context.GetSystemService(serviceName);
:
}
2 Replies
r2d25551
r2d2555110mo ago
Getting closer. How do I wait for an Android Activity to finish:
intent = new Intent(Intent.ActionOpenDocumentTree);
intent.SetFlags(ActivityFlags.NewTask);
MauiApplication.Current.StartActivity(intent);
intent = new Intent(Intent.ActionOpenDocumentTree);
intent.SetFlags(ActivityFlags.NewTask);
MauiApplication.Current.StartActivity(intent);
Accord
Accord9mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.