Can't configure cordova email plugin - plugins

I'm using Cordova 3.1 building an Android app. I'm trying to configure the email composer plugin using
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
When I add the android platform via the CLI it says the email-composer is installed, I can see it in android.json, and I even added a feature tag for it in config.xml as follows:
<feature name="EmailComposer">
<param name="android-package" value="de.applant.cordova.plugin.email-composer" />
</feature>
the cordova_plugins.js file in platforms\android\assets\www contains and entry for the plugin with "clobbers":["plugin.email"]
When I try to reference one of the object methods using the following code:
window.plugin.email.isServiceAvailable
I get the following error:
object "call to unknown plugin: EmailComposer".
Is there another step I'm missing to configure the plugin?

Related

Integration of the Pendo SDK with the .NET MAUI sample application causes an error

One of our production applications which developed in Xamarin cross platform UI mobile framework, we have been using Pendo-sdk-ios and pendo-sdk-android nuget packages successfully.
https://support.pendo.io/hc/en-us/articles/4404246699419-Developer-s-Guide-to-Installing-the-Pendo-Xamarin-iOS-SDK
Now we are upgrading our xamarin application to .NET MAUI. I am facing an issue, while integrating Pendo-sdk packages with .NET MAUI Appliction.
Here are the steps to reproduce this issue:
A new sample MAUI .NET application has been created, and it has successfully run.
iOS Platform
I added pendo-sdk-ios nuget package version 2.16.0.5665(latest stable version).
I can use the Pendo package in the AppDelegate, the following code does not throw an error.
using Pendo;
I am trying to initialize the Pendo SDK in the AppDelegate, however I am getting the following error.
string pendo_app_key = "eyJhbGci…<KEY_HERE>";
PendoManager.SharedManager().Setup(pendo_app_key);
PendoManager.SharedManager().SetDebugMode(true);
.../CheckingPendo/Platforms/iOS/AppDelegate.cs(22,22): Error CS0012: The type 'NSObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. (CS0012) (CheckingPendo)
I am experiencing the same compile time error after adding Xamarin.ios reference as well.
​​<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-ios'">
<PackageReference Include="pendo-sdk-iOS" Version="2.16.0.5665" />
</ItemGroup>
<ItemGroup>
<Reference Include="Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065" />
</ItemGroup>
Android Platform
After adding the pendo-sdk-android nuget package version 2.16.1.4053(latest stable version).
I am getting the following error.
​​
/Users/[user]/.nuget/packages/xamarin.android.support.annotations/28.0.0.3/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(3,3): Error MSB4062: The "Xamarin.Android.Support.BuildTasks.VerifyVersionsTask" task could not be loaded from the assembly /Users/[user]/.nuget/packages/xamarin.android.support.annotations/28.0.0.3/build/monoandroid90/Xamarin.Android.Support.BuildTasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. (MSB4062) (CheckingPendo)
I would appreciate your assistance in resolving this issue.
Pendo has released support for maui:
Pendo Maui Plugin
Instruction could be found here
I have checked all the packages you provided with it's reference and dependencies. They are all not support .net 6. So you could not use it in Maui.
Pendo SDK does not currently support MAUI, but they most likely will.

Add plain Android library to a Flutter plugin

This might be a duplicate of this question. But it has no answer and I will give some details here.
I have created a module with File->New Module->Android Library inside my Flutter plugin's android project. And now I have a structure like below:
|-my_plugin
|-android
|-settings.gradle
|-build.gradle
|-mylibrary
|-build.gradle
/android/settings.gradle:
rootProject.name = 'my_plugin'
include ':mylibrary'
/android/build.gradle:
...
dependencies {
implementation project(':mylibrary')
}
When I build example plugin project (which is automatically created by Flutter CLI) with flutter build apk or flutter run, I get this error:
Project with path ':mylibrary' could not be found in project ':my_plugin'.
Any suggestions?
For those who are still looking for a solution. You can try this.
Instead of putting the below code in the plugin setting.gradle, place it in example/android/settings.gradle
include ':mylibrary'

Ionic native device plugin #ionic-native/device returns all nulls

I need to do a device detection in my Ionic project so I've installed #ionic-native/device plugin per instructions here: https://ionicframework.com/docs/native/device/
However when I wire it in inside of a component, then run ionic serve to preview changes, console.log returns Device object with all values set to null, same happens when I try to use individual property e.g. this.device.model:
Here is how I use it inside of a component:
import {Device} from "#ionic-native/device";
// ...
#Component({
// ...
})
export class MyComponent {
constructor(private device: Device) {
}
ngOnInit() {
console.log(this.device);
}
}
And I've added it to AppModule as well:
import {Device} from "#ionic-native/device";
// ...
#NgModule({
// ...
providers: [
Device
]
})
export class AppModule() {
}
Cordova device plugin was auto injected into config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget <!-- ... --> >
<!-- ... -->
<plugin name="cordova-plugin-device" spec="2.0.0" />
</widget>
Here is my Ionic stack (at least packages that should be relevant to the issue):
"#angular/*": "^5.2.4", // all packages
"#ionic-native/*": "4.5.2", // all packages
"#ionic-native/device": "4.5.2"
"ionic-angular": "3.9.2",
"cordova-plugin-device": "2.0.0",
"typescript": "2.6.2"
Thanks!
UPDATE:
I was able to get device details in the browser by running:
cordova run browser
This assumes you have added browser as a platform, if not run:
ionic cordova platform add browser
(From the link in the answer posted by #AndrewLively: https://stackoverflow.com/a/49034015/448816)
If you are running in the browser using ionic serve then most of the ionic-native plugins won't work since it is not treated by ionic as a valid browser platform.
This is not well documented, but is discussed in an issue in the ionic-native repo.
Should see the packages installed and see they are in the same version in "package.json"
Core and Native packages must be in the same version or the native package should not be larger.
The folder "platforms" must be delete
Use these commands
ionic build
ionic cordova platform add browser
cordova run browser
code for .ts
console.log('Device Model is: ' + this.device.model);
And works !

ionic platform add android- Package name must look like: com.company.Name

Im getting started in developing ionic app, I followed the guide in http://ionicframework.com/docs/guide/installation.html
just in case: the command "ionic platform add ios" works and i have android sdk installed.
when typing the command "ionic platform add android" i get this error:
Adding android project...
/Users/LihaiMac/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin/node_modules/q/q.js:126
throw e;
^
Package name must look like: com.company.Name
Error: /Users/LihaiMac/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
I tried searching an answer in other related posts, but not successful..
I'll appreciate any help in solving my problem..
What mladen5 said is correct. You need to go to the config.xml of your Cordova/Phonegap project and edit the id to meet the package name expectations.
The name can be found in the ID property and is "com.mydomainhere.appnamehere" in the example config below:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.mydomainhere.appnamehere" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Awesome app</name>
<description>
The worlds most awesome app
</description>
<author email="your#email.com" href="http://www.anurlhere.com">
Author name
</author>
<content src="index.html" />
<access origin="*" />
</widget>
"Package name must look like: com.company.Name" that error is very helpful. You have package name that is invalid, probably starts with number.
Android package rules:
The first character after a period must not be a number
The first character must be a letter or underscore
Usually the app id is your company's reserved Internet domain name.
The app id must consist of letters, numbers, and underscores.
The best way to do it is when you're creating a new app. The Ionic command line interface(CLI) supports two options to do that the right way:
You can also app and package name define using command line interface(CLI) creation you project time like this bellow.
ionic start MyNewApp blank --appname MyNewApp --id com.ionicbyrequest.mynewapp
MyNewApp is my project app name.
Simple, no ? Now when you deploy to stores your id will be unique.
I had the same problem with Ionic a few weeks ago. The problem can be fixed by editing config.xml.
Find the line that starts with
The syntax inside id="" must be com.company.(company name)
ID should be without dashes, just words separated with dots: word.word.word
In your config.xml give the package name according to your project package name
Give widget id in your config.xml as com.test.testapp

Facebook Connect with Phonegap Build not including cdv-plugin-fb-connect.js

I am using Phonegap Build and Hydration
My config does include the plugin
<gap:plugin name="com.phonegap.plugins.facebookconnect">
<param name="APP_ID" value="my_appId" />
<param name="APP_NAME" value="my_namespace" />
</gap:plugin>
On build.phonegap.com it is showing it my app under the plugins tab...
Installed 3rd Party Plugins
com.phonegap.plugins.facebookconnect 0.4.0
Installed PhoneGap Plugins
org.apache.cordova.camera 0.2.3
org.apache.cordova.console 0.2.3
org.apache.cordova.device 0.2.3
org.apache.cordova.dialogs 0.2.2
org.apache.cordova.geolocation 0.3.2
org.apache.cordova.globalization 0.2.2
org.apache.cordova.media-capture 0.2.3
org.apache.cordova.splashscreen 0.2.3
org.apache.cordova.vibration 0.3.3
I'm not specifying which version of PG to use so it is running 3.1.0
In my index.html file, in the head I have
<script src="phonegap.js"></script>
<script src="device.js"></script>
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script src="cdv-plugin-fb-connect.js"></script>
<script src="facebook-js-sdk.js"></script>
Here is the part that I can't seem to find anyone else having a problem with:
In my deviceready callback I am testing for typeof CDV == 'undefined' to test and it's coming back as undefined. As far a I can tell is that cdv-plugin-fb-connect.js isn't getting included correctly.
Am I correct that cdv-plugin-fb-connect.js and facebook-js-sdk.js do not need to be copied into my www directory because they are included there by PGB?
Btw, I'm testing on Android Nexus5
<access origin="*" /> is in my config
I could never get CDV to work correctly on my Android emulator/phone.
However, I did get FacebookConnectPlugin.js to work, which is also included in the same official PhoneGap/Cordova Facebook plugin.
There are two version of this file -
One that you include in your root www/js folder
Another which is loaded by PhoneGap from the plugin folder after you deploy to platforms/android (I believe this is handled by cordova.js).
The second one overrides the JS SDK calls with native ones, so it degrades gracefully when you run in a browser.
For an example that actually seems to work, see the www folder in the develop branch.
e.g.
var getStatus = function () {
facebookConnectPlugin.getLoginStatus(
function (response) { alert(JSON.stringify(response)) },
function (response) { alert(JSON.stringify(response)) });
}