【问题标题】:Get my app to launch another app with parameters让我的应用程序使用参数启动另一个应用程序
【发布时间】:2015-11-26 17:50:34
【问题描述】:

从我的 android 混合应用程序 (cordova/phonegap) 我想启动媒体播放器并播放来自 ip-camera 的 rtsp 流。

我首先确认播放器可以通过从 adb 启动来播放流:

adb shell
am start -n com.android.gallery3d/.app.MovieActivity -d rtsp://root:1@10.253.253.2/axis-media/media.amp

为了让它从我的应用程序中运行,我认为这个插件可能会有所帮助......

https://github.com/lampaa/com.lampa.startapp

但我不知道如何将 adb 命令中出现的内容翻译成该插件所需的内容。

例如我尝试了很多东西,包括...

// cordova plugin add https://github.com/lampaa/com.lampa.startapp.git
navigator.startApp.start(
    ["com.android.gallery3d/.app.MovieActivity", 
    ["-d rtsp://root:1@10.253.253.2/axis-media/media.amp"]],  
function(message) { 
   console.log("start: " + message); 
}, 
function(error) { 
    console.log("start " + error);
});

【问题讨论】:

    标签: cordova


    【解决方案1】:

    试试这个:

    navigator.startApp.start([
        ["com.android.gallery3d", "com.android.gallery3d.app.MovieActivity"],
        ["rtsp://root:1@10.253.253.2/axis-media/media.amp"]
    ], function(message) {
        console.log(message); // => OK
    }, 
    function(error) { /* error */
        console.log(error);
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-08
      • 1970-01-01
      • 1970-01-01
      • 2012-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多