plugin is removed on android app on build - android

I'm trying to integrate push notifications using the pushwoosh plugin. I installed the plugin using the command line:
phonegap plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin.git
and in config.xml:
<access origin="*.pushwoosh.com" />
and added the javascript code for initPushwoosh() and the rest of the code.
Then when I build the app successfully
I found that pushwoosh plugin and some code from config.xml is removed automatically.
The push notification also does not work.
What am I missing?

Make sure you are editing the files in the correct "www" folder. There could be more than one "www" folders and one could override another when you make a build.

Related

CordovaError: Project name must not begin with a number

I'm building an app which name starts with a number "100 Times". But when I try to add the Android platform:
ionic cordova platform add android
I get the following error:
CordovaError: Error validating project name. Project name must not begin with a number
My config.xml is like:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp.times100" ...>
<name>100 Times</name>
...
</widget>
As far as I know it is not a Google Play restriction, cause there are a lot of apps with names that starts with numbers.
How can I use an application name that starts with a number with Cordova?
I was able to use numbers at beginning of my app name following the steps below:
Create the android studio project running "cordova prepare android"
Open the Android Studio Project and edit "res/values/strings.xml"
Replace the "app_name" node content with the name you want.
Build the APK using Android Studio.
That's a cordova bug. There is an issue for that:
https://github.com/apache/cordova-android/issues/584
There's also a pull request to fix it in version 9.x of cordova-android:
https://github.com/apache/cordova-android/pull/859
For now the only way is to use some (hackish) workaround to fix that.
I generate the apk in a CI environment using docker containers, so executing commands manually in Android Studio was out of question in my case, so I forked the cordova-android repo, commented the lines that does that unnecessary (and wrong) validation and installed the android plugin in my project from the forked github repo.

Unity android plugin for FCM

I'm trying to add Google FCM push notification function to Unity project. I'm surprised that there are no resources about Google FCM for Unity. There are only old Google GCM resources. This is my step-by-step progress below.
Make Android Studio project and register it to a FCM console project
Add google-service.json to '/app' and configure build.gradle (project and module)
Add MyFirebaseInstanceIDService, MyFirebaseMessagingService java classes and onTokenRefresh, sendRegistrationToServer, onMessageReceived, sendNotification methods according to sample example in FCM document
Add services for the classes to AndroidManifest.xml
After that, I tested the Android Studio project on mobile, and FCM console push notification works well. Then, I started to configure the Android Studio project for Unity.
Change 'application' to 'library' in build.gradle (module) and add deleteOldJar, exportJar for AndroidPlugin.jar
Add classes.jar of Unity to Android Studio library and module setting
Remove 'android:icon ...', 'android:theme ...' in AndroidManifest.xml
Export jar and add AndroidPlugin.jar, AndroidManifest.xml to 'Plugins/Android' in Unity
Then, I tested the Unity project on mobile. It is built without exception, but FCM console push notification didn't work. (I made test log for confirming that the Android Studio libray is well plugined for Unity, the log worked well)
Maybe, there are somethings to add to 'Plugins/Android' except AndroidManifest.xml and AndroidPlugin.jar like references below.
Google firebase analytics plugin for unity - StackOverflow
http://joxi.ru/Q2KeQD7C3zdYrj
But, I couldn't find my answer. Please let me know what I have to do or add.
Sorry for bad english and long explanation. Many thanks :)
I used Unity SDK in OneSignal.
It is very simple, easy, and cool SDK for push notification.
Reference link below.
https://onesignal.com/
This approach will not be feasible.
Jar files do not contain resources, and as such, the json file will be missing from the jar build. Alternatively, aar files, which would in theory contain the resources, are interpreted by Unity3D as pure plugin and ignores the resources or at least some, specially when using gradle. But Unity is getting better at it.
Try https://firebase.google.com/docs/unity/setup. It's new and I got the sample project to work already.
Just to add: the new Plugin of Firebase for Unity3D worked liked a charm. Use cases like pure system try notification don't need a single line of additional programming on the client side. Data Messages are very easily implemented as well.

How to get owner's name / email using phonegap build

I am running a phonegap build application version 3.4.0.
Phonegap build has a list of plugins https://build.phonegap.com/plugins where you can find a lot of them for example to send mails, etc.
But i can't see a plugin that retrieve the account information for android devices like the email or name of the owner.
To add a plugin you have a config.xml file in wich you add a line like this:
<gap:plugin name="com.jcjee.plugins.emailcomposer" version="1.4.6" />
My problem is that i found a plugin that seems to be useful: https://github.com/seltzlab/AccountList-Phonegap-Android-Plugin but i cannot find a way to include it on phonegap build compilation.
I can see that you can create a custom public plugin http://docs.build.phonegap.com/en_US/developer_contributing_plugins.md.html but i don't need that, i only need to use one, wich is already created.
Is there any way to achieve this?
Thanks in advance.

Cordova android class not found

I'm trying to add a cordova plugin to a salesforce mobile android app. By default, the salesforce app uses the SalesforceSDK project as a library. This project already contains several cordova plugins listed in its config.xml file, however, when I try to add a plugin and config.xml file to my own project in the same way, cordova fails to initialise, citing 'Class not found' as the reason.
I've looked around to see what the structure should look like then to make it find the class, but every result I find shows a different way of setting up the config file, or adding a plugin.xml file somewhere, and nothing has worked so far because I just can't figure out how to do it properly.
Currently I only have
<?xml version="1.0" encoding="utf-8"?>
<plugins>
<plugin name="OpenAppPlugin" value="com.dev.testapp.OpenAppPlugin"/>
</plugins>
in my config file, because all the cordova guide says is to add that line.
Turns out, I had to copy the entire config.xml containing all the plugins to my own project and add the line to that.

How to add our own made plugin in cordova 3.1 project though Cordova CLI for android platform?

I am able to add the plugin which is designed by Apache though cordova command line interface for android platform. But I could not able to add the plugin which are designed by own though the CLI. please help me sort out to add plugins which is made by own in cordova3.1 project.
If you create a plugin.xml file in your custom plugin directory (read this doc on how to do this: http://cordova.apache.org/docs/en/3.1.0/plugin_ref_spec.md ), you should be able to either:
put the plugin up on a git repository somewhere (I've only used github, but any git repo should work: cordova plugin add http://github.com/youraccount/yourrepo/
put the plugin somewhere on a filesystem: cordova plugin add relative/path/to/dir/containing/plugin.xml or cordova plugin add /absolution/path/to/dir/containing/plugin.xml
Using the plugin.xml lets you leverage the automatic injection of xml into the config.xml, etc.
After a lot of struggle I found the solution for the above problem.
Create Cordova Project(suppose CordovaDemo) through CLI
Add the platform android
Add the your own plugin your.js file inside the js of CordovaDemo/www/js/your.js
Edit the CordovaDemo/www/index.html Add below script tag
< script type="text/javascript" src="js/your.js">
Add your YourPlugin.java file inside the src of your android platform
6.Add this inside res/xml/config.xml
< feature name="YourPlugin">
< param name="android-package" value="yourpackage.YourPlugin" />
< /feature>
Import android project in eclipse and run

Categories

Resources