使用 Xam.Plugins.Notifier 进行本地通知我可以在 Android 中显示通知。但是,当我点击通知时,它会重新加载应用程序。类似于远程通知的方式。
我在 MainActivitiy.cs 中处理 OnNewIntent() 但它从不触发。
如何点击 Xam.Plugins.Notifier 发出的本地通知,以便 OnNewIntent() 触发并且我可以显示 Shell 项目?
protected async override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
var title = intent.GetStringExtra("title");
if (title != null)
{
await Shell.Current.GoToAsync("Tools/Sales");
}
}
我有一个启动应用程序的 SplashScreen Activity:
如何将启动活动的 Intent 从 Splash 传递给 MainActitity
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true, LaunchMode = Android.Content.PM.LaunchMode.SingleTop)]
public class SplashActivity : AppCompatActivity
{
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
base.OnCreate(savedInstanceState, persistentState);
}
// Launches the startup task
protected override void OnResume()
{
base.OnResume();
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
}
public override void OnBackPressed() { }
}