【问题标题】:Open WAZE with Titanium App使用 Titanium 应用程序打开 WAZE
【发布时间】:2017-11-18 12:54:03
【问题描述】:

我正在开发一个用户需要去某个地方的应用程序,所以,我的客户想要使用 WAZE 应用程序,但我无法让它在 Android 中运行。

根据 WAZE,我必须这样做:

try
{
    String url = "waze://?q=Hawaii";
    Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) );
    startActivity( intent );
}
catch ( ActivityNotFoundException ex  )
{
  Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "market://details?id=com.waze" ) );
 startActivity(intent);
}

所以,我将其转换为钛代码,如下所示:

            try{
               var intent = Ti.Android.createIntent({
                   action: Ti.Android.ACTION_VIEW,
                   data: waze
               });                           
               Titanium.Android.startService(intent);                     
             }               
             catch(e){
               Titanium.Platform.openURL("market://details?id=com.waze");
             }

(“waze”是一个字符串变量,我有 url)

但总是去“Catch”广告带我去商店。 (Waze 已经安装在我的设备上)

这是您可以在 waze 主页中找到信息的链接。 https://www.waze.com/es-419/about/dev

提前致谢。

【问题讨论】:

    标签: android appcelerator waze


    【解决方案1】:

    我认为您需要创建一个新活动,而不是启动一个服务。我相信你在 try 块中的代码应该是:

    try{
               var intent = Ti.Android.createIntent({
                   action: Ti.Android.ACTION_VIEW,
                   data: waze
               });                           
               Ti.Android.currentActivity.startActivity(intent);                   
             }               
             catch(e){
               Titanium.Platform.openURL("market://details?id=com.waze");
             }
    

    【讨论】:

      猜你喜欢
      • 2020-08-11
      • 2017-02-22
      • 2018-07-10
      • 2019-03-28
      • 2019-06-05
      • 2018-06-25
      • 2020-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多