【问题标题】:Is there a way to open a browser tab automatically in Android?有没有办法在 Android 中自动打开浏览器选项卡?
【发布时间】:2019-05-14 04:31:27
【问题描述】:

我正在寻找一种在特定时间/每天自动打开特定链接的浏览器的方法。

也许有某种脚本,用于 Bowser 的插件,但我还没有找到。

有没有人知道一个好的解决方案?

【问题讨论】:

    标签: android


    【解决方案1】:

    我建议你使用AalarmManager here 就是一个例子

    然后这是你应该执行的代码

    String urlString = "your_url";
    Intent intent = new 
    Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
    
    
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
        intent.setPackage("com.android.chrome"); 
        try { 
        context.startActivity(intent); 
        } 
        catch (ActivityNotFoundException ex) { 
         context.startActivity(intent);
         }
    

    【讨论】:

      【解决方案2】:

      在我看来,这是三件事的结合,设置警报、触发意图并确保意图具有在浏览器中打开特定 uri 的数据。

      start activity from an alarm

      open a uri

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-26
        • 2020-04-24
        • 2021-01-23
        • 2014-12-12
        • 2015-05-30
        • 1970-01-01
        • 1970-01-01
        • 2015-04-11
        相关资源
        最近更新 更多