Anybody who succeeded in adding "Email Composer" Cordova plugin to Ionic 5 project (for Android12)? - cordova-plugins

I have created a simple Ionic 5 app and would like to add the functionality that would allow sending emails (including those scheduled).
I have tried the https://ionicframework.com/docs/native/email-composer but found myself stuck with this supporting Android 12. Is there anybody who succeeded?

I am use Appery.io to do that, they are based on Cordova and I have no issues with their Ionic 5 app working on Android 12 devices.They offer https://docs.appery.io/docs/ionic-5-mailgun-email-sample-app-with-server-code-plugin, https://docs.appery.io/docs/ionic-5-sendgrid-email-sample-app-with-server-code-plugin. They also offer to try bulk mailing using their SendGridEmail plugin: https://docs.appery.io/docs/using-sendgrid-plugin-for-bulk-mailing.

After searching around for a while, I came across Simon Grimm's video in which he added this exact plugin to an Ionic/Capacitor project. Prior to finding the video I was having trouble figuring out how to add the Android configuration properly to AndroidManifest.xml. When running ionic cap sync, I got a warning that I needed to add the following to AndroidManifest.xml:
<intent>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
</intent>
But there was no documentation on how exactly to do this. The solution was in the video:
<manifest ...>
<queries>
<intent>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
</intent>
</queries>
</manifest>
The intent element needs to be placed inside <queries>, which should be placed directly within the <manifest> tag (and not inside <application> or <activity>). After doing this, I was able to get the email composer to open up on Android 12 with Gmail.
Reference: https://www.youtube.com/watch?v=AF0jnmbbpbE

Related

Always getting +clicked_branch_link" false, really weird

I have integrated Branch SDK in my swift application and whenever I am installing the application through quick links, I am always getting +clicked_branch_link" : false, and that's why I can not add custom events to my application.
1) How to check custom events before iOS application goes live?
2) Is there any way to check deep linking in test builds?
Thanks in advance
The most common issue that can lead to this behavior is a mismatch between the Branch key used in the Project and the link that you are using. If you are using debug mode, make sure to use links from the test area of the dashboard. Once you fix the issue with +clicked branch link being false, you will be able to test deeplinking and custom events.
I am using branch.io in react native, I had the same issue on test mode, I have to declare TestMode=true in AndroidManifest.xml like code below.
In Android:
<meta-data android:name="io.branch.sdk.TestMode" android:value="true" />
Now Branch.io part looks as:
<meta-data android:name="io.branch.sdk.TestMode" android:value="true" />
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_lm3ztzvrR4sI0dKQ76Lq6nbcsEnMV1wp"/>
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_pbXCutzyH3rH0gGP772UgdmbCsnKM3yC"/>

firebase social login not redirected to the app , ionic 3 , ios

I am trying to implement social login in my ionic 3 app with the help of 'firebase' authentication.
I followed this artical https://javebratt.com/ionic-social-login-firebase/
I installed all the plugins(cordova-plugin-browsertab,cordova-plugin-inappbrowser ..etc)
and did exactly same as in the article.
Then I ran the app on both android and ios devices.
in android device the facebook/google login page is opened in the 'in app browser' and it is redirected to the app successfully after the login process.everything works fine.
But in the iPhone the facebook/google login pages are opened in a new safari browser instance and after the login it redirect to localhost, and it is not redirected back to the application.
can anyone help me with this?
thank you
I believe the issue is related to ionic in iOS now defaulting to WKWebView (http://ionicframework.com/docs/wkwebview/) which has issues with Firebase.
ionic native app URLs in iOS now appear as http://localhost instead of file://assets/.../index.html.
The suggested workaround at this time is to downgrade to UIWebView.
Firebase Auth is looking into a solution for this.
I had the same issue, and changing the webview engine didn't solve it for me.
What worked for me was to add
<allow-navigation href="http://*" />
to config.xml.
I guess this worked for me because that localhost:8080/... link works over http, but I only had https://* allowed in my config.xml before that.
Not sure though why this is not an issue on Android, but hope this helps!
I have the same issue. I have followed all the steps described in https://firebase.google.com/docs/auth/web/cordova?authuser=2 but in ios it does not work (in Android all is working fine). I think it is related with the 'customurlscheme' property because this is the property that contains the app name that has to be reopened, but I have checked all the places where I am using it and all seems to be correct (I modified the package name of my app and I think this could be related with the issue).
I will try to fix it, if I find the solution I will let you know.
I don't have the required "rep" to comment on bojeil's answer above... but to expand on his answer:
Adding:
<preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
to the config fixed this issue for me.
You will need to edit your config.xml.
This line will allow you to be redirected back to your app.
<allow-navigation href="*" />
This line will solve the disallowed user agent screen
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />

Branch.io Cordova SDK not generating links

I am trying to integrate Branch.io into my mobile app, mostly for the purpose of tracking and rewarding referrals. I have the plugin mostly working, but it is failing at the most important part, generating the links. The app successfully initiates Branch, creates a Universal Object and I get a confirmation alert every time the app opens. It also successfully opens the share sheet when I click the share button and fills in the message text, but it doesn't contain the link. I've also noticed that the Branch.io dashboard is not recognizing that I've integrated the SDK. I am using PhoneGap build 6.2.0 and Cordova Branch SDK version 2.6.0
Here is my the Branch snippet of my config.xml
<plugin name="branch-cordova-sdk" spec="^2.6.0" /><!-- If available via Cordova registry; consider changing to an NPM reference. -->
<branch-config>
<branch-key value="key_live_xxxx" />
<uri-scheme value="xxxx" />
<link-domain value="xxxx.app.link" />
<ios-team-release value="xxxx" />
</branch-config>
And here's a screen shot of the alert after creating a universal object and of the share sheet
Universal Object
Share Sheet
It Is the issue with PGB Service
i had same issue with my project also... i am taking build using phonegap build service. universal object is initializing but the link is not generating.. in ios 9.3 the Share sheet comes. but there is no link . in ios 10 even Share sheet is not opening
Try Using Mac with cordova my issue solved
check this link ..
https://forums.adobe.com/thread/2290461

Usage description issue in Ionic and iOS 10 builds

My ionic application for iOS worked fine, till today when I wanted to make a new build.
This is what get's returned by Apple:
Dear developer,
We have discovered one or more issues with your recent delivery for
"AppName". To process your delivery, the following
issues must be corrected:
This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSPhotoLibraryUsageDescription key with a string value explaining to
the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSCameraUsageDescription key with a string value explaining to the
user how the app uses this data.
Though you are not required to fix the following issues, we wanted to
make you aware of them:
Missing Push Notification Entitlement - Your app includes an API for
Apple's Push Notification service, but the aps-environment entitlement
is missing from the app's signature. To resolve this, make sure your
App ID is enabled for push notification in the Provisioning Portal.
Then, sign your app with a distribution provisioning profile that
includes the aps-environment entitlement. This will create the correct
signature, and you can resubmit your app. See "Provisioning and
Development" in the Local and Push Notification Programming Guide for
more information. If your app does not use the Apple Push Notification
service, no action is required. You may remove the API from future
submissions to stop this warning. If you use a third-party framework,
you may need to contact the developer for information on removing the
API.
This are my dependencies:
"ngstorage": "~0.3.10",
"ion-image-lazy-load": "*",
"ngCordova": "~0.1.24-alpha",
And I use the Barcode scanner in ngCordova. So I did this:
$ cordova plugin rm phonegap-plugin-barcodescanner
$ cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="Scan QR-Codes" --save
The config.xml has this in the bottom now:
<plugin name="cordova-plugin-camera" spec="~1.2.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="description" />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="description" />
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Scan QR-Codes" />
</plugin>
But still I get the same e-mail from Apple that my app has one or more issues..
Although, almost all Cordova plugins are now updated to support user-sensitive usage description. For example, update your barcode plugin version to the latest build (as of November 7th 2016) where they added support for usage description:
<plugin name="phonegap-plugin-barcodescanner" spec="~6.0.3">
But if you don't find a plugin supporting it yet and you need to set the description in *-Info.plist then please YOU NEED TO STOP THERE
Modifying the *-Info.plist for Cordova applications are not recommended because this will require you to save that change which might get overwritten after build process. So as the clean alternative you should use cordova-custom-config.
cordova plugin add cordova-custom-config --save
Why should I use it?
While some platform preferences can be set via Cordova/Phonegap in the
config.xml, many (especially ones related to newer platform releases)
cannot. One solution is to manually edit the configuration files in
the platforms/ directory, however this is not maintainable across
multiple development machines or a CI environment where subsequent
build operations may overwrite your changes.
This plugin attempts to address this gap by allowing additional
platform-specific preferences to be set after the prepare operation
has completed, allowing either preferences set by Cordova to be
overridden or other unspecified preferences to be set. Since the
custom preferences are entered into the config.xml, they can be
committed to version control and therefore applied across multiple
development machines, CI environments, and maintained between builds
or even if a platform is removed and re-added.
Now add the following to your config.xml file under <platform name="ios"> block:
<custom-config-file parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
<string>This app needs access to your Photo Library to include a screenshot with feedback foo.</string>
</custom-config-file>
<custom-config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>Allow to scan member's pass</string>
</custom-config-file>
This will automatically add those in your *-Info.plist.
Update 1 (23rd Feb 2018)
If you are using cordova-custom-config plugin version < 5 then replace custom-config-file tag with config-file.
https://github.com/dpa99c/cordova-custom-config#changes-in-cordova-custom-config5
Update 2 (19th Jan 2019)
See this answer for Cordova CLI >= 6:
https://stackoverflow.com/a/38013943/2405040
I'm using phonegap plugin org.apache.cordova.camera and solution which 100% works is here :
All you have to do is put values in config.xml file and build with phonegap.
My config.xml :
<plugin name="org.apache.cordova.camera">
<variable name="CAMERA_USAGE_DESCRIPTION" value="App would like to access the camera." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="App would like to access the library." />
</plugin>
You'll have to add the NSPhotoLibraryUsageDescription and NSCameraUsageDescription into your *.plist in your xcode;
NSPhotoLibraryUsageDescription = Privacy - Photo Library Usage Description
NSCameraUsageDescription = Privacy - Camera Usage Description
Then into the value just add a description for those privacy settings.
Hope it helps
You must add the key NSPhotoLibraryUsageDescription into Info.plist (in Xcode), and the value must be the reason for the user to allow camera usage (appears in the request camera confirm dialog)
Found the solution: $ cordova plugin list and re-install all plugins and read their docs of how to install them regarding the NSPhotoLibraryUsageDescription etc .
Add the below in your config.xml file and it'll work fine.
<gap:plugin name="cordova-plugin-media-capture" source="npm">
<param name="CAMERA_USAGE_DESCRIPTION" value="We'd like to access your camera to let you take a photo"/>
<param name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="We'd like to access your photo library to let you pick a photo"/>
<param name="MICROPHONE_USAGE_DESCRIPTION" value="We'd like to access your microphone to let you record an audio"/>
</gap:plugin>
Here is the complete config.xml file for PhoneGap Build.
https://github.com/moodlehq/moodlemobile-phonegapbuild/blob/master/config.xml

Add facebook iOS SDK without Xcode for a Phonegap Build app

I've been able to successfully build my iOS app without using Xcode. My app is a collection of HTML, CSS, and Javascript, along with my config.xml that I'm able to compile with Phonegap Build.
The app's basic functionality has been tested on iPhones and works well, but now I want to add a social layer to the app with the FacebookConnect plugin for Phonegap Build. However, the documentation on GitHub requires the app to be setup in Xcode.
Without using Xcode, is there a way to download the SDK (not as a .pkg) and add it to my project files that I upload to Phonegap Build to complile? If so, where do I get the files, which files do I need, and where do I include these files in my project structure?
Here is my current project structure:
-config.xml
-index.html
-includes
--css
--js
Perhaps there is a way of doing this with GitHub, but I've never done pull requests or anything like that. I simply work in my text editor and am not sure how to pull from GitHub.
Phonegap Build Plugins
Thank you for any help you can offer on this!
I have successfully implemented the FacebookConnect Plugin for Phonegap Build on Windows without Xcode.
I recommend just following the instructions on the Phonegap Build Plugins page and ignore the instructions on the GitHub page (which talks about Xcode and other things you don't need for the Build plugin). They have now updated the GitHub page instructions to direct Phonegap Build users away from the GitHub instructions and over to the Phonegap Build Plugins page.
For Step 1 (Setting your app up on facebook), select Native iOS App and the Bundle ID is the same as your "id" in your config.xml (i.e. com.company.appname) and you can set the App Store IDs to "0" while testing.
For Step 2, make sure you use facebook-js-sdk.js. At one time there was a typo.
A good way to test things out is to paste the content of the example Simple app on GitHub into a new index.html file and upload it with your normal config.xml file to Phonegap Build . I did this for one build on my app and then after I tested it, just uploaded my normal index.html file. The only change you will need to make in the index.html of the Example app is to put your Facebook App ID at the bottom in the FB.init function. I also changed response.session to response.authResponse to match the Facebook JS SDK, but I'm not sure if that is necessary.
Be sure to update your config.xml file with everything mentioned in Step 3. I also added the following code:
<access origin="http://m.facebook.com" />
<access origin="http://graph.facebook.com" />
<access origin="http://api.facebook.com" />
<access origin="http://fbcdn.net" subdomains="true" />
<access origin="http://akamaihd.net" subdomains="true" />
The above code is not necessary if you have the following in your config.xml file already:
<access origin="*" />
The FacebookConnect plugin is using the Facebook JS SDK, which you can learn more about here: https://developers.facebook.com/docs/reference/javascript/.
Also, one other issue I ran into that the Phonegap Build Team is working on is that when asking for permissions, you cannot just ask for the Basic Permissions by leaving off the scope option. For now, you must include at least one scope option for the login function to work.
function fbLogin () {
FB.login(function(response) {
if (response.authResponse) {
alert('User Login Success!');
} else {
alert('User cancelled login or did not fully authorize.');
}
}, { scope: "email" });
}
Most developers probably want to ask for more than the Basic Permissions, so this shouldn't be that big of an issue.
My responses above are from discussions about the Facebook Plugin over on the Phonegap Build Support Site. You can learn more about the plugin and current issues and solutions there.
It took me a little while to figure this stuff out, so hopefully this will help others save some time.

Resources