科尔多瓦+安卓:无法从应用程序打开拨号盘或邮件意图 [英] Cordova + android : not able to open dial pad or mail intent from app

查看:170
本文介绍了科尔多瓦+安卓:无法从应用程序打开拨号盘或邮件意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题。我无法打开或者拨打与应用pre定义号码或邮件意图垫。

I have a strange problem. I am not able to open either dial pad with pre defined number or mail intent from app.

我使用的用于创建应用程序科尔多瓦8.0.1的NetBeans。我科尔多瓦的版本是4.0.0。

I am using netbeans 8.0.1 for creating cordova apps. My Cordova version is 4.0.0.

我创建下列步骤的应用程序,并选择HelloWorld的科尔多瓦的模板。我修改它的HTML文件,如下的内容:

I created an app following the steps and selected a template of HelloWorld Cordova. I modified its html file to something as below:

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
         <!--WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323--> 
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <h1><a href="tel:+919685968574" >call</a></h1><br>
        <h1><a href="mailto:abc@gmail.com?subject=Hello" >Send Mail</a></h1>
        <script type="text/javascript" src="cordova.js"></script>
    </body>
</html>

奇怪的是,我在上次尝试,安装科尔多瓦的所有核心插件,但它仍然没有奏效。

Strange thing is that, I at last tried, installing all the core plugins of Cordova, but still it didn't work.

请帮我...谢谢...

Please help me out... Thanks...

编辑:我所指向这些链接,但它没有帮助:

I refered these links, but it didnt help:

<一个href=\"http://stackoverflow.com/questions/13233091/call-$p$pdefined-number-automatically-on-android-with-phonegap\">Call自动在Android上的PhoneGap predefined号

Call predefined number automatically on Android with PhoneGap

http://rickluna.com/wp/2012/02/making-a-phone-call-from-within-phonegap-in-android-and-ios/

推荐答案

是的..我也被困这个错误了3天......之后,我找到了一个解决方案。我不记得从我发现它的URL,但我记得解决方案。

Yes.. I too was trapped with this error for 3 days... and after that I found a solution. I dont remember the URL from which i found it, but I remember the solution.

首先,您需要安装应用程式科尔多瓦浏览器插件为您的应用程序。

First of all, You need to install In-App browser plugin of Cordova into your app.

然后,只需稍加修改你的HTML你会得到你想要的东西。

and then, with just a little modification to your html you will get what you want.

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
         <!--WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323--> 
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <h1><a href="#" onclick='call()'>call</a></h1><br>
        <h1><a href="#" onclick='email()'>Send Mail</a></h1>
        <script type="text/javascript" src="cordova.js"></script>
        <script>
            function call(){
                window.open("tel:+919685968574", "_system"); // or if _system doesnt work
                window.open("tel:+919685968574", "_blank");
            }

            function email(){
                window.open("mailto:abc@gmail.com?subject=Hello", "_system"); // or if _system doesnt work
                window.open("mailto:abc@gmail.com?subject=Hello", "_blank");
            }
        </script>
    </body>
</html>

希望你得到你想要的。以上只是一个例子。你可以修改它按您的要求。

Hope you get what you want. The above was just an example. You can modify it as per your requirements.

这篇关于科尔多瓦+安卓:无法从应用程序打开拨号盘或邮件意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆