MAUI中如何打开应用商店应用详情页
//打开应用商店详情页
public async Task<bool> OpenStoreAppDetails(string appId)
{
string uri = string.Empty;
#if WINDOWS
uri = $"ms-windows-store://pdp/?ProductId={appId}";
#elif ANDROID
uri = $"market://details?id={appId}";
#elif IOS || MACCATALYST
uri = $"itms-apps://itunes.apple.com/app/id{appId}";
#elif TIZEN
uri = $"tizenstore://ProductDetail/{appId}";
#endif
return await Launcher.Default.OpenAsync(uri);
}
appId 在 Windows 中为 App 的 ProductId
appId 在 iOS/MacCatalyst 中为 App 的 bundle ID
appId 在 Android 中为 App 的包名
如果Android想变成出现弹窗自己选择应用商店,而不是打开默认应用商店
#if ANDROID
public Task<bool> OpenStoreAppDetails(string appId)
{
var uri = new Uri($"market://details?id={appId}");
var intent = new Intent(Intent.ActionView, AndroidUri.Parse(uri.OriginalString));
var chooserIntent = Intent.CreateChooser(intent, string.Empty);
var flags = ActivityFlags.ClearTop | ActivityFlags.NewTask;
chooserIntent!.SetFlags(flags);
Application.Context.StartActivity(chooserIntent);
return Task.FromResult(true);
}
#endif
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)