简体   繁体   English

Android - 作为新应用启动 Intent

[英]Android - Launch Intent as new app

Is it possible to launch an Intent as a new application?是否可以将 Intent 作为新应用程序启动?

Wanted behaviour:通缉行为:

  • The user clicks a button in my app.用户单击我的应用程序中的按钮。
  • The media player Intent is launched and plays the desired media.启动媒体播放器 Intent 并播放所需的媒体。
  • The user long-press the home button .用户长按主页按钮 In this menu, I would like to see both the media player and my app.在此菜单中,我希望同时看到媒体播放器和我的应用程序。 I would like the user to be able to listen to the music using his desired media player and being able to put my app in foreground.我希望用户能够使用他想要的媒体播放器收听音乐,并能够将我的应用程序置于前台。

Thanks谢谢

I am not sure as I've never used it, but I guess you could use the intent flag FLAG_ACTIVITY_NEW_TASK for this.我不确定,因为我从未使用过它,但我想您可以为此使用意图标志 FLAG_ACTIVITY_NEW_TASK。

Intent intent = your intent;
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

See http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK for more info.有关详细信息,请参阅http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK

Cheers干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM