Making Phone Call Ionic App - ionic-framework

I'm using this code in the view:
<a href="tel:{{doc.emergency}}" class="button phone button-full" >Phone Call</a>
And I can't make the call.
This is my config.xml
<access origin="tel:*" launch-external="yes" />
<allow-intent href="tel:*" />

For me the following works:
<access origin="tel:*" launch-external="yes"/>
<allow-intent href="tel:*" />
<allow-navigation href="tel:*" />
A similar question was asked here.

Try using the native plugin:
https://ionicframework.com/docs/native/call-number/
You can create a function that receive the phone number as a parameter.

Related

Ionic 3 Deep link opening any link issue

I have an Ionic 3 app, I installed the ionic-plugin-deeplinks plugin and it works for what I want. When I press on a certain link in an email, it opens my app and redirects it to the necessary page. However, I have some URL on the web version of the app that has target="_blank" on them. Whenever I click on those, it opens the app instead of a new tab. I don't want it to open the app or ask me to open the app in those situations because it has nothing to do with the app. Just open the link in a new tab. I've tried a million things but I can't find any solution sadly...
Here's my code in config.xml.
<plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
<variable name="URL_SCHEME" value="myapp123" />
<variable name="DEEPLINK_SCHEME" value="https" />
<variable name="DEEPLINK_HOST" value="app.myapp123.com" />
<variable name="ANDROID_PATH_PREFIX" value="/" />
<variable name="ANDROID_2_PATH_PREFIX" value="/" />
<variable name="ANDROID_3_PATH_PREFIX" value="/" />
<variable name="ANDROID_4_PATH_PREFIX" value="/" />
<variable name="ANDROID_5_PATH_PREFIX" value="/" />
<variable name="DEEPLINK_2_SCHEME" value=" " />
<variable name="DEEPLINK_2_HOST" value=" " />
<variable name="DEEPLINK_3_SCHEME" value=" " />
<variable name="DEEPLINK_3_HOST" value=" " />
<variable name="DEEPLINK_4_SCHEME" value=" " />
<variable name="DEEPLINK_4_HOST" value=" " />
<variable name="DEEPLINK_5_SCHEME" value=" " />
<variable name="DEEPLINK_5_HOST" value=" " />
</plugin>
I want this link to act normally
Random URL
but this link to ask or open the Ionic app
Random URL
Is there a way to set this up?
I use another plugin to achieve the same:
<plugin name="cordova-plugin-customurlscheme" spec="^4.3.0">
<variable name="URL_SCHEME" value="myapp123" />
</plugin>
After that you can create links like "myapp123://path-to-page".
So the protocol is "myapp123" instead of https.
In that way URL's like https://app.myapp123.com/ won't be caught anymore by your app.
More info on installation can be found here:
https://github.com/EddyVerbruggen/Custom-URL-scheme
One warning though: ionic 3 deeplinking for reset password : there seems to be an issue when using this technique in combination with gmail.

Cordova - internal hyperlinks always open in Safari

I'm very new to Cordova, so it may be that I don't fully understand its purpose. Let me start with what I'm trying to achieve overall.
We have an asp.net website that has mobile support, that I'm basically just trying to wrap with an iPhone app. The site of course runs on an IIS server, so I just want a thin wrapper to launch the site, and remove the address bar, navigation, etc. It's my understanding that you can achieve that with the Cordova hybrid approach.
I followed the tutorial, and got the site to launch within an xCode iPhone Simulator, and it came up just like I wanted to.
The problem I'm having is that hyperlinks within the site launch the target page in a Safari browser. And from all of my googling, it seems like this is the opposite problem most people have. It seems like most people struggle with external sites opening within the app, which basically locks them out of their app. I'm just trying to go from Page1 to Page2 on my own site within the app.
I was able to reproduce this problem with the simplest of sites, so I'll post the relevant bits. In this example, clicking on "Page 2" will open up in Safari.
Asp.net site:
Page1.html
<html>
Page 2
</html>
Page2.html
<html>
Page 2
</html>
Cordova:
Index.html
<!DOCTYPE html>
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
</head>
<body>
Cordova site
</body>
<script>
window.location = "http://192.168.1.157:8081/Page1.html";
</script>
</html>
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="vsisolutions.testsite" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Test Site</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="http://192.168.1.157:8081/*" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="~4.1.1" />
<plugin name="com.msopentech.authdialog" spec="~0.1.6" />
</widget>
Thanks for the help!
This was a bug
It was fixed on latest released version of cordova-ios 4.2.0
So you don't have to do any hack to make it work anymore, just have to use the allow-navigation tag to set the urls you want to allow to navigate inside the app, and the rest of them will open in safari as you have allow-intent set for all http and https urls.
I found that in Cordova the WKWebView plugin (it could be occurring in the UIWebView as well) asks around for any other plugins to see if they can use URL on the link. This was being picked up by the CDVIntentAndNavigationFilter and running through the logic as in:
- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType: (UIWebViewNavigationType)navigationType
{
NSURL* url = [request URL];
switch (navigationType) {
case UIWebViewNavigationTypeLinkClicked:
// Note that the rejection strings will *only* print if
// it's a link click (and url is not whitelisted by <allow-*>)
if ([self.allowIntentsWhitelist URLIsAllowed:url]) {
// the url *is* in a <allow-intent> tag, push to the system
[[UIApplication sharedApplication] openURL:url];
return NO;
}
// fall through, to check whether you can load this in the webview
default:
// check whether we can internally navigate to this url
return ([self.allowNavigationsWhitelist URLIsAllowed:url]);
}
}
Because the navigationType == UIWebViewNavigationTypeLinkClicked it was passing it off to the browser via [[UIApplication sharedApplication] openURL:url];
Currently I have only found a hack around this and that is to override this logic by treating links in the same way i.e. like so:
switch (navigationType) {
case UIWebViewNavigationTypeLinkClicked:
// Note that the rejection strings will *only* print if
// it's a link click (and url is not whitelisted by <allow-*>)
if ([self.allowIntentsWhitelist URLIsAllowed:url]) {
// the url *is* in a <allow-intent> tag, push to the system
// [[UIApplication sharedApplication] openURL:url];
return YES;
}
// fall through, to check whether you can load this in the webview
default:
// check whether we can internally navigate to this url
return ([self.allowNavigationsWhitelist URLIsAllowed:url]);
}
}
This is obviously not ideal and I'll ask around on the Cordova forum for a better solution which I'll post here once I find it.
Page 2
This should work.
Just changing allow-navigation to append with * worked:
<allow-navigation href="http://yourwebsite/*" />

Facebook, App Links on Android: not getting the schema (Uri for the App Link's Android URL) on the field 'data' of the Intent

We are developing Facebook AppLinks for Android.
We followed all the directives from Facebook Developer page:
https://developers.facebook.com/docs/applinks/add-to-content
https://developers.facebook.com/docs/applinks/android
In our Web page (the target url) we define the metas:
<meta property="al:android:url" content="mySchema://?id=3643020" />
<meta property="al:android:app_name" content="myAppName" />
<meta property="al:android:package" content="com.my.package" />
<meta property="al:android:class" content="com.my.package.screens.BrowseableActivity"/>
inside the tag.
For the Schema, we also tried with this one:
<meta property="al:android:url" content="mySchema://id=3643020" />
(without the ? character)
In our Android App, in the Manifest for the BrowseableActivity we define:
<activity android:name=".screens.BrowseableActivity"
android:theme="#style/Theme.myAppName.myTheme" >
<intent-filter>
<action android:name="com.my.package.screens.BrowseableActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mySchema"/>
</intent-filter>
</activity>
When we test:
We share from our App a link to Facebook, where the "link" property is the 'target url' that has the metas.
That is ok.
Inside the Facebook Android App (version 18.0.0.24.14) we see the post shared in the previous step.
We click on the post, and our App is open!
Everything is ok until here.
OUR PROBLEM:
According to Facebook documentation in the Intent that opens our "BrowseableActivity", the 'data' field
should have the following information:
data: "mySchema://id=3643020?target_url=http%3A%2F%2Fwww.ourtargeturl.com%2Fdirectory"
this is: the Schema (Uri or Android Url) and the Target_url
But for us, we only got this:
data: "http%3A%2F%2Fwww.ourtargeturl.com%2Fdirectory"
We only got the target_url.
In this page of Facebook ( https://developers.facebook.com/docs/applinks/android ) they said that
if you don't receive 'the Schema' if because you don't define the meta "al:android:url" in the
target_url. But, we define it.
Also, in the others fields of the Intent, (the extras x example) we don't see 'the Schema' information.
And that info is what we need, and we don't know what else to try.
Thanks,
Don't specify the class name. If you specify the class name, it will use the package name/class name combination to create an intent with a componentName that directly addresses your app/activity. What goes in the "data" field is actually undefined at that point.
If you skip specifying the al:android:class property, then it will use your custom url.

Google richsnippet videoobject does not appear as video

On my video page I put videoobject metadata but google is not aware of that?
Am I missing something?
Here is my code:
<meta itemprop="name" content="Video namei" />
<meta itemprop="description" content="Video description" />
<meta itemprop="duration" content="PT05M13S" />
<meta itemprop="url" content="url at the browsers address bar"/>
<meta itemprop="thumbnailURL" content="image url from cdn" />
<span itemtype="http://schema.org/ImageObject" itemscope="" itemprop="thumbnail">
<link href="same url with thumbnailURL" itemprop="contentUrl" />
<meta content="640" itemprop="width" />
<meta content="360" itemprop="height" />
</span>
<meta itemprop="embedURL" content="embed video link (swf)" />
<meta itemprop='playerType' content='Flash' />
<meta itemprop="uploadDate" content="2013-11-18T17:57:00+0200" />
<meta itemprop="width" content="640" />
<meta itemprop="height" content="360" />
You should nest all of your video markup within the video object schema, and you also should not hide the video title and description with a meta tag. You need to use span tags for those instead. And lastly, make sure your markup includes the contentURL item property, as Google will use it to generate video previews and helps them verify your video.

Adding properties to uploaded content in Alfresco

I am using Alfresco Web Quick Start to create a basic CMS website. I was wondering if someone could explain how to add properties/metadata to content which I have uploaded. For example if I have a gallery of images (with the default metadata of Author, Published, Size and Mime Type) and wanted to have a data taken property etc, how would I implement this?
I have done some research but am yet to find a concrete solution, any help on this matter would be greatly appreciated! Thanks!
The available metadata for a given node in Alfresco are dictated by its type and aspects.
Alfresco already ships with an EXIF aspect (look here for "exif:exif") you might want to use for your use case, which unfortunately the WCM QS hides. You should create a share-config-custom.xml file (sample here, official docs) which should list all the fields from the exif:exif aspect you want to expose.
Something like the following should work:
<config evaluator="model-type" condition="exif:exif">
<forms>
<form>
<field-visibility>
<show id="exif:dateTimeOriginal"/>
</field-visibility>
</form>
</forms>
</config>
It is a royal pain in the ass.
First you need to create a Model. Inside that model you need to create an Aspect. All this goes in XML file #1.
Then you need a context file to register the aspect. This is XML file #2.
And a properties files to give the aspect a friendly name.
And a web-site-custom-config to list all of the properties that were listed in XML file 1. This is XML file #3
And you need a share-custom-config. This has a different format from XML file #3, but serves the same purpose.
And finally you need to create a rule that automatically applies the aspect to each item in a folder.
Reference: http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/
share-custom-config.xml
<alfresco-config>
<!-- Repository Library config section -->
<config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
<!--
Whether the link to the Repository Library appears in the header component or not.
-->
<visible>true</visible>
</config>
<config evaluator="string-compare" condition="DocumentLibrary">
<!--
Used by the "Manage Aspects" action
For custom aspects, remember to also add the relevant i18n string(s)
cm_myaspect=My Aspect
-->
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="my:sampleProps" />
<aspect name="ac:androidContentProps" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
</config>
<config evaluator="node-type" condition="cm:content">
<forms>
<form>
<field-visibility>
<!-- fields from my example aspect -->
<show id="my:propOne" />
<show id="my:propTwo" />
<show id="my:propInt" />
<show id="my:propFloat" />
<show id="my:propDateTime" />
<show id="my:propDate" />
<show id="my:propBoolean" />
<show id="my:propQName" />
<show id="my:propCategory" />
<show id="my:propNodeRef" />
<show id="my:propPath" />
<!-- fields for android content -->
<show id="ac:propNotify" />
<show id="ac:propNotificationSummary" />
<show id="ac:propArchiveDate" />
<show id="ac:propPublishDate" />
<show id="ac:propPriority" />
<show id="ac:propRegion" />
<show id="ac:propMarket" />
<show id="ac:propDistrict" />
<show id="ac:propStore" />
</field-visibility>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="Remote">
<remote>
<endpoint>
<id>alfresco-noauth</id>
<name>Alfresco - unauthenticated access</name>
<description>Access to Alfresco Repository WebScripts that do not require authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>none</identity>
</endpoint>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-feed</id>
<name>Alfresco Feed</name>
<description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
<connector-id>http</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<basic-auth>true</basic-auth>
<identity>user</identity>
</endpoint>
<endpoint>
<id>activiti-admin</id>
<name>Activiti Admin UI - user access</name>
<description>Access to Activiti Admin UI, that requires user authentication</description>
<connector-id>activiti-admin-connector</connector-id>
<endpoint-url>http://localhost:8080/alfresco/activiti-admin</endpoint-url>
<identity>user</identity>
</endpoint>
</remote>
</config>
</alfresco-config>