【问题标题】:Is it possible to launch an app from my app as if it was launched through its notification? I have the StatusBarNotification object是否可以从我的应用程序启动应用程序,就好像它是通过通知启动的一样?我有 StatusBarNotification 对象
【发布时间】:2019-10-21 13:17:15
【问题描述】:

我想启动一个应用,就像它是通过我的应用上的通知面板启动一样。我有状态栏通知对象,有没有办法通过它获得意图?

当我使用包名称启动应用程序时,它会启动应用程序,就像单击它一样。

if (launchIntent != null) {
    startActivity(launchIntent);
}

【问题讨论】:

    标签: java android android-intent notifications notification-listener


    【解决方案1】:
    PendingIntent launchIntent = notif.getNotification().contentIntent;
    
       if (launchIntent != null) {
           try {
              launchIntent.send();
           } catch (PendingIntent.CanceledException e) {
              e.printStackTrace();
           }
      }
    

    【讨论】:

      猜你喜欢
      • 2022-09-23
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 2019-10-11
      • 2016-06-30
      • 1970-01-01
      • 1970-01-01
      • 2022-01-03
      相关资源
      最近更新 更多