Configuring cordova-plugin-firebase - firebase

I have installed cordova-plugin-firebase.
In the root folder of my app I have zipped www folder, config.xml, google-services.json and GoogleService-Info.plist.
I use this file in phonegap build and it builds fine for ios.
I have installed the app in a iPhone 7, but when I run the app it crashes.
In the plugin page I can read (https://www.npmjs.com/package/cordova-plugin-firebase#important-notes):
"IMPORTANT NOTES
This plugin uses a hook (after prepare) that copies the configuration
files to the right place, namely platforms/ios/\/Resources for ios and platforms/android for android.
Firebase SDK requires the configuration files to be present and valid,
otherwise your app will crash on boot or Firebase features won't work.
PhoneGap Build
Hooks does not work with PhoneGap Build. This means you will have to
manually make sure the configuration files are included. One way to do
that is to make a private fork of this plugin and replace the
placeholder config files (see src/ios and src/android) with your
actual ones, as well as hard coding your app id and api key in
plugin.xml."
So I think what is happening is that GoogleService-Info.plist and google-services.json are not placed in the right place.
But, how can I fix this? I don't understand the solution about making a private fork?!?
Any help?
Thanks

I answer myself.
Because of hooks doesn't work in phonegap build I have installed Xcode and Android Studio.
Now the plugin is working in android, but not ios.
I will post a question for this.

Related

Why are node modules working on firebase emulator but not working post deployment?

I am using intl-tel-input in my project which I installed using npm. Every thing seems to work fine when I test using Firebase emulators but it stops working post deployment.
Upon checking the Sources tab in Chrome dev tools, I can see that the module is not properly included. (Pls check images) However, I am completely unable to figure out why. Please help!
Emulator Screenshot with the Telephone Input field working fine.
Screenshot taken post deployment with the Telephone input field broken.
Source File - intlTelInput.js located at /node_modules/intl-tel-input/build/css/intlTelInput.js
Source File - intlTelInput.css located at /node_modules/intl-tel-input/build/js/intlTelInput.css
By default Firebase ignores node_modules directories when deploying.
There are a few options you could use to resolve this.
Use a build tool like Rollup or Webpack to generate bundles that include node dependencies.
Copy required node_modules files to a different directory like assets and load them from there.
Update firebase.json to not ignore node_modules on deploy. Note that this will probably greatly increase the size of deployed applications if you have any number of node packages.

Google Play ask for deobfuscation txt file, Xamarin Forms

When I previously released my application it went well, but now I try to upload a new version of my application and Google Play says that it has some java/kotlin code in it and asks for me to upload an deobfuscation txt file. I have been looking for answers and the people mention a "mapping.txt" file which android studio creates when you are using proguard or R8 code shrinkers.
Does anyone know where I can generate such file or where it may be?
Note: I haven't added or upgraded any nuget packages since the last time I updated the application and I already looked in the bin/obj folders with no luck. Also I checked the archive folder that creates when I bundle the application.
The obfuscation step of ProGuard is disabled when building a Xamarin Android application. Therefore, there's no deobfuscation file generated and no need to upload one. You can ignore the warning.
From the Xamarin.Android documentation:
The Xamarin.Android ProGuard configuration does not obfuscate the APK. In fact, it is not possible to enable obfuscation through ProGuard (even through the use of custom configuration files).
Edit: There is currently an open PR in Xamarin.Android to have ProGuard generate the mapping.txt file. Note that this is only to silence the warning, though. In theory, it's not needed.

How to integrate firebase in an Ionic project (android/iOS)?

I am reading articles and testing ways to implement analytics and push notifications in my Ionic app using firebase.
My ionic app targets both android and ios platforms, so where do I place the google-services.json firebase file? Do I have to create an 2 apps within firebase if I need to use firebase for android and iOS?
I am reading many articles some of which say root folder, whereas some mention to put it in the apps folder. Some say we have to then update the config.xml to include the foll:
<resource-file src="google-services.json" target="app\google-services.json" />
I have also read that we need to update the gradle file with application and project level dependencies.
I have put the file in platform/android/app folder and things are working correctly now.
I just want to know what is the best practice when using Ionic and Firebase, where do I place the file and what config changes do I have to make?:
For an Ionic android app
For Ionic iOS app
For Ionic app for both android and iOS platforms
Have a look at the documentation of the firebase plugin :
https://github.com/arnesson/cordova-plugin-firebase
For Android, you have the google-services.json file, and for iOS you have the GoogleService-Info.plist file. These files are required by firebase to work on both iOS and Android. You have to place theses files at the same level as config.xml.
This plugin uses a hook (after prepare) that copies the configuration
files to the right place, namely platforms/ios/\/Resources for ios and platforms/android for android.
So you don't need the resource-file directive in your config.xml, since it is copied automatically.
You don't need to edit the build.gradle file, but If you have other google play plugins installed (like maps or admob), the compilation may not work.
Your build may fail if you are installing multiple plugins that use
Google Play Services. This is caused by the plugins installing
different versions of the Google Play Services library. This can be
resolved by installing cordova-android-play-services-gradle-release.
If your build is still failing, you can try installing
cordova-android-firebase-gradle-release. For more info, read the
following comment about locking down the specific versions for play
services and firebase. It is suggested to use + instead of 15.+ to
ensure the correct versions are used.
EDIT : Since you're using cordova-plugin-firebase-analytics and not cordova-plugin-firebase, it seems that they didn't implement any hook to copy the files. You'll have to place these directives in your config.xml :
<platform name="android">
<resource-file src="google-services.json" target="app\google-services.json" />
...
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
...
Be sure to install cordova-support-google-services

Firebase Push notifications with PhoneGap Build using cordova-plugin-fcm

I need to implement push notifications in a PhoneGap Build app that I'm developing.
I didn't find much documentation on using the new Google service, Firebase Cloud Messaging (FCM), but since it is supposed to be what we have to use now I searched for an API that could make my life easier.
I found: https://www.npmjs.com/package/cordova-plugin-firebase
So I added to my config.xml:
<plugin name="cordova-plugin-fcm" source="npm" />
And put the google-services.json I've created from https://console.firebase.google.com/ in the root of the folder I zip to upload to the Phonegap Build.
But I get the following error:
Execution failed for task ':processReleaseGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
/project/src/release/google-services.json
/project/google-services.json
I created the "project" folder in the root and put the file there but that doesn't work neither.
Currently my app folder looks like:
\css
\img
\js
\res (icons and splashscreens)
index.html
config.xml
google-services.json
If anyone knows where I've to put that file or have any other way to implement this even using other API, I would really appreciate it.
I've never used Phonegap CLI, I've always been using Phonegap Build.
Cordova introduced the resource-file tag some time ago and it also works in Phonegap Build.
You can use that instead of a forked plugin to copy the google-services.json and GoogleService-Info.plist files
Put the in the root of your project and the use the resource-file tag in the config.xml like this:
If using cordova-android 7 or newer:
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
older versions
<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
</platform>
iOS
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
You can also put it inside www folder, in that case in my examples add www/ before the file name in the src field.
https://cordova.apache.org/docs/en/7.x/config_ref/index.html#resource-file
The files need to be alongside the www folder, problem is that Phonegap Build only lets you upload the contents of said folder, so you can't upload the files.
Fortunately there's something you can do; Build installs the plugins directly from npm, and plugins can work thought the whole project, so what you need is a plugin that copies the files [google-services.json, GoogleService-Info.plist] for you.
Most of the work has already been done: cordova-plugin-fcm-config.
This plugin copies the required FCM configurations in the project root folders and Xcode project. It is used in combination with the great cordova-plugin-fcm plugin.
It wasn't built for this purpose but works wonderfully.
There's an added complexity though; since you can't upload plugins (you can only add a reference to it in your config.xml), and this plugin needs your own app configuration files, you'll have to:
Clone/Fork the plugin into your own repository.
Replace the configuration files.
Upload it somewhere Build can find.
Where do you upload it? That might be tricky. The infrastructure is built around the idea that plugins are for general purposes and can be configured in each project xml, so npm makes sense. But in this case your plugin will contain very specific data to your project, so uploading to npm would pollute the namespace in my opinion.
I don't know about you, but I have a paid account, so I publish the plugin in my own repository and submit as a private plugin. This is what I recommend.
For me I had to go into the .xcodeproj file and change Main Interface from MainViewController.xib to CDVLaunchScreen.storyboard
Rebuild and it worked. My app was built with Ionic and I started it in Ionic Creator.

Generate apk file for meteor app

I have a project is working for android browser. Is there a way to generate the apk file?
Also, are there anything that I shoud know before generating the apk file?
There are a few steps to follow in order to generate the Android application file (.apk) from a meteor app:
meteor install-sdk android
Have the mobile-config.js file in your project root (mobile-config.js example)
meteor add-platform android
meteor build ~/your-output-dir --server=yourapp.meteor.com
Then you will have your .apk file in ~/your-output-dir/android/unaligned.apk
If you want to proceed and submit to Google Play Store, here are the steps to follow: https://guide.meteor.com/mobile.html#submitting-android
Hope this helps!
You can build an APK file with meteor build command.
Read more about it in the docs: http://docs.meteor.com/#/full/meteorbuild or by typing meteor help build in your terminal.
Starting with Meteor 1.2, the bundled Android tools have been removed and a system-wide install of the Android SDK is now required. This should make it easier to keep the development toolchain up to date and helps avoid some difficult to diagnose failures. The meteor install-sdk command no longer attempts to download and install the Android tools for you (it has been deprecated and just points you to these instructions).
like imslavko says, meteor build works pretty fine, also if you are looking for more information take a look on this Meteorpedia
It work for me
Reegards
As of now playstore has started giving warning while uploading APK about unoptimised bundle and insisting for uploading Android app bundle.
Insted of generating APK why not generate .aab of your project and reduce size of the application.
For people wondering about how to generate .aab for your existing project can read my blog here:
My blog link

Resources