Meteor, Accounts.callLoginMethod() doesn't call custom login handler on mobile device - meteor

My code works as expected in desktop browser and on android emulator but it doesn't work on android device (debug mode via USB).
I've registered custom login handler in server code
Accounts.registerLoginHandler("customLoginHandler", function (options) {
console.log("customLoginHandler()");
});
Then on specific UI event I'm calling it from client code
console.log("calling custom login");
Accounts.callLoginMethod({
methodArguments: [ {clientUser: "hello", clientPassword: "world"} ],
userCallback: function() {
console.log("clientCustomLogin callback");
}
});
console.log("done");
Console output when running this code on desktop or android emulator
customLoginHandler()
on mobile
calling custom login
done
whole client code is located inside
if (Meteor.isClient) {
block. Why the output is so different?
Meteor version 1.1.0.2, server OS - Linux, mobile - Android 4.4.2
Meteor is started by the command:
meteor run android-device
Packages installed:
$ meteor list
accounts-base 1.2.0 A user account system
http 1.1.0 Make HTTP calls to remote servers
meteor-platform 1.2.2 Include a standard set of Meteor packages in your app
twbs:bootstrap 3.3.4 The most popular front-end framework for developing responsive, mobile first projects on the web.

Short answer: remove the app on android, then run meteor run android-device
Long asnwer.
I don't know why it is possible, but It looks like the app was not fully updated (or not updated at all starting from some point) on the mobile device.
I was playing with accounts-base, accounts-password and accounts-ui packages reinstallation, but then I noticed that when I replaced my template with standard {{> loginButtons}} (in main html file) nothing has changed on mobile after meteor rerunning and the application refreshing on android.
Then I just removed the app from android and started meteor again.
After that the applicated started to work as expected.

Related

NgRx store runtime check NgZone failing on android

We implemented a network check as a side effect with window event online and offline.
online$ = createEffect(() => {
return fromEvent(window, 'online').pipe(mapTo(NetworkActions.deviceOnline()));
});
This works fine in Desktop Chrome and on iOS Safari but somehow results in a strictActionWithinNgZone runtime check on Android:
{
"state": {
"keyboard": {
"isKeyboardOpen": false
},
"network": {
"isDeviceOnline": true
}
},
"error": "Error: Action '[Network] Device Online' running outside NgZone. https://ngrx.io/guide/store/configuration/runtime-checks#strictactionwithinngzone"
},
Does anybody have any idea why this only happens in Android and why it even is a problem to begin with?
Edit:
As far as I understand it, fromEvent(window, '...') should always be inside the zone because zone.js does patch all Browser EventTarget.
Also this is on an Ionic + Cordova App but only when built on Android. Only reason I could see for the difference could be in the Webview it is running in but other than that it is just basic RxJS and Angular
Thanks Pascal
It looks like this was a super specific problem with an Ionic + Cordova App and the Cordova Network Plugin https://ionicframework.com/docs/native/network
This seems to interfere with the Android Platform. Without the Plugins the Error does not occur but the online and offline window events also never fire on Android. So I guess this has nothing to do with NgRx.

Unity Firebase Crashlytics not sending any crash reports, getting "failed to retrieve settings" error on logcat

Unity editor version: 2019.3.15f1
Firebase Unity SDK version: firebase_unity_sdk_6.15.2
Additional SDKs im using: Unity IAP, Gamesparks, Ironsource, Facebook, Appsflyer, GameAnalytics
Platform im using the Unity editor on: Windows
Platform im targeting: Android
Scripting Runtime: IL2CPP
Problem
I am getting data on firebase analytics, but I cannot get crashlytics to report anything. Im stuck on this...
Steps to reproduce:
Add the firebase analytics and crashlytics sdks.
Add the google-services.json GoogleService-Info.plist files somewhere in assets folder
Add this code to initialise the firebase
// Use this for initialization
void Start ()
{
// Initialize Firebase
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
// Create and hold a reference to your FirebaseApp,
// where app is a Firebase.FirebaseApp property of your application class.
// Crashlytics will use the DefaultInstance, as well;
// this ensures that Crashlytics is initialized.
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
// Set a flag here for indicating that your project is ready to use Firebase.
VisualDebugger.SetText("crashlytics initialised");
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}",dependencyStatus));
VisualDebugger.SetText("crashlytics NOT initialised: " + dependencyStatus);
// Firebase Unity SDK is not safe to use here.
}
});
Invoke("IsCrashEnabled", 5f);
}
void IsCrashEnabled()
{
VisualDebugger.AddLine("IsCrashlyticsCollectionEnabled: "+Firebase.Crashlytics.Crashlytics.IsCrashlyticsCollectionEnabled);
}
In order to get the app to run with the facebook sdk installed Ive added these two lines to proguard-user.txt
-keep public class com.facebook.**{public *; }
-keep public class com.facebook.internal.**{ public *; }
and commented out the following lines from mainTemplate.gradle
//implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
//implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
//implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
When I run the app, firebase is initialised successfully. Also Firebase.Crashlytics.Crashlytics.IsCrashlyticsCollectionEnabled returns true.
I crash the app in a number of different ways, then open it again without reinstalling. But no crash reports are sent.
When I watch logcat when starting the app I see this error from firebase each time the app is opened
2020-09-28 16:18:59.332 25773-25847/? E/FirebaseCrashlytics: Failed to retrieve settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/REDACTEDblahblahblah/settings
Update Oct 19, 2020:
Today a developer updated the issue I linked in this answer saying the Firebase team fixed a backend bug last Friday (Oct 16) that was affecting some new Unity Android apps registering w/ Firebase - likely the bug behind your issue. I had already solved the issue in my own project using the below solution, but if you haven't yet updated your project, I recommend running it again and seeing if Crashlytics is working for you now..
I've been dealing with the same issue this week in Unity 2019.4.11f1 - i see the same error message about not being able to retrieve settings, but with my specific project and appIds in the URL.
I found a solution in this Github issue, which suggests the problem is caused by the version of an android library that is a dependency for the Unity Firebase Crashlytics package. My rough understanding is that the firebase-crashlytics-unity library is a wrapper around android library firebase:firebase-crashlytics, and the unity package allows the underlying native Android code to be used from Unity. Version com.google.firebase:firebase-crashlytics:17.10.0 has issues with getting the settings for some Firebase projects on Android. Myself and several others following this issue found forcing Unity to use this specific dependency at version 17.1.1 resolved the issue.
Someone else with the same issue in the thread contacted Firebase support and was told:
The error you are seeing "Failed to retrieve settings" is related to
the SDK version being used. If you go to "Assets > Firebase > Editor>
CrashlyticsDependencies" you can manually update the SDK to point to
the latest Crashlytics SDK version 17.2.2. Please give it a try and if
you continue having issues, let me know.
It turned out this advice wasn't quite right - some of us following the thread then experienced a different issue when using the Android Crashlytics SDK version 17.2.2 with Unity crashlytics version 6.16.0. So I'd specifically recommend trying out the below suggestion or other solutions in the thread to set your Android crashlytics library to v17.1.1.
Changes I made in my project to address this:
First, I updated my unity firebase packages in the package manager to use version 6.16.0. In my project 4 packages were installed - core, analytics, crashlytics, and messaging.
Then I searched for the the Crashlytics package's dependency file - Crashlytics-Dependencies.xml (found by searching project - was in /Library/PackageCache/com.google.firebase.crashlytics#6.16.0/Firebase/Editor/ for me). This file initally had "com.google.firebase:firebase-crashlytics:17.0.0" listed, which I updated to be: "com.google.firebase:firebase-crashlytics:17.1.1".
As an extra precaution, I also added created a MyProject-Dependencies.xml file, as was suggested by a user in the thread - this file also specifies version "com.google.firebase:firebase-crashlytics:17.1.1".
Next, I modified the Unity build process to use a custom mainTemplate.gradle file to specify dependencies,
rather than using the External Dependency Resolver to manage and
embed unity packages (option in Build Settings > PlayerSettings >
Android).
I also updated the settings on the External Dependency Manager Android Ressolver:
Disabled AutoResolve and Disabled Resolve on Build (we dont want EDM updating dependencies without our knowledge when building)
I also turned disabled AndroidPackageInstallationEnabled - this has made the resolution process much faster and removed a bunch of .aar files from the android dependencies list, and hasn't caused any problems in my project.
I then ran External Dependency Resolver > Android > Force Resolve, which after the settings changes above, should now embed a list of the dependencies for the Android build into the mainTemplate.gradle file - Check this file (its in Assets/Plugins/Android) and you should now see com.google.firebase:firebase-crashlytics:17.1.1 in that list.
Also, I recommend reading this article about managing Unity Firebase dependencies from one of the Firebase developer advocates, Patrick Martin. It helped me wrap my head around how Android dependency management in Unity works, as well as how the Android gradle build process works.

C++ exception in 'nativeFlushQueueImmediate' when trying to access firebase on react native

I'm using https://rnfirebase.io in react native, and I'm getting this strange error when trying to call firebase sign in with phone
submit() {
firebase
.auth()
.signInWithPhoneNumber(this.phoneInput)
.then(confirmResult => console.log(confirmResult))
.catch(error => console.log(error));
}
What could it be?
This can happen when you've updated a native dependancy via npm but have not rebuilt the native side of your app.
The JS bundle will generally have the latest code immediately (after packager restart) but the native side will not until you rebuild your app on xcode/studio; therefore causing argument mismatches across React Native's bridge as both could be expecting very different arguments based on their previous versions.
The same applies in reverse, you've re-built your native app but not restarted the packager after updating a native dependancy via npm.

Meteor update is stuck downloading packages

I am trying to update to Meteor 1.2.
But when I run Meteor update, it starts to run and get to
Downloading 8 packages -
And the spinner stops and its been like this for 20 minutes or so.
Ive tried quitting the process and starting it up again, and the same result.
Any suggestions on what I can try? The server seems to still start ok, but I cannot update
Here is the package list
3stack:accounts-password-hook 0.0.2 Overwrites Accounts.createUser to provide an afterCreateUser hook
abpetkov:switchery 0.1.0 Switchery (official) - turns your default HTML checkbox inputs into beautiful iOS 7 style swi...
accounts-password 1.1.1* Password support for accounts
alanning:roles 1.2.13 Role-based authorization
aldeed:autoform 5.3.2* Easily create forms with automatic insert and update, and automatic reactive validation.
aldeed:collection2 2.3.3* Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema 1.3.3 A simple schema validation object with reactivity. Used by collection2 and autoform.
aramk:rrule 2.1.0 JavaScript library for working with recurrence rules for calendar dates.
babrahams:transactions 0.6.21* Undo/Redo stack based on transactions
benmgreene:moment-range 1.0.7 Fancy date ranges for Moment.js packaged for Meteor.
cmather:handlebars-server 2.0.0 Allows handlebars templates to be defined on the server in .handlebars files
coffeescript 1.0.6* Javascript dialect with fewer braces and semicolons
cunneen:mailgun 0.9.1 Easily send emails using Mailgun as your email provider.
cunneen:sendgrid 0.9.0 Easily send emails using Sendgrid your email provider.
czbaker:apac 0.0.3 Access to the Amazon Product Advertising API, using the NodeJS 'apac' module.
czbaker:lightbox2 2.7.1_1 Provides the Lightbox2 JS library for Meteor.
dhtmlx:scheduler 0.0.2 dhtmlxScheduler is an event calendar that allows adding a Google-like scheduler on a web page.
edgee:slingshot 0.7.1 Directly post files to cloud storage services, such as AWS-S3.
email 1.0.6* Send email messages
francocatena:status 1.3.0* Display the connection status between the browser and the Meteor server
gilbertwat:bootstrap3-daterangepicker 1.3.21_1 Date range picker component for Twitter Bootstrap 3
houston:admin 2.0.3* A zero-config Meteor Admin
ian:accounts-ui-bootstrap-3 1.2.59+ Bootstrap-styled accounts-ui with multi-language support.
iron:router 1.0.9 Routing specifically designed for Meteor
jonblum:jquery-cropper 0.10.1* Fengyuan Chen's terrific jQuery plugin for cropping/zooming/rotating images, packaged for Me...
juliancwirko:s-alert 2.4.1* Simple and fancy notifications / alerts / errors for Meteor
juliancwirko:s-alert-slide 1.1.3* Slide effect for s-alert - simple and fancy notifications / alerts for Meteor.
kadira:debug 2.1.0* Full Stack Debugging Solution for Meteor
kevohagan:sweetalert 0.5.0* a beautiful replacement for javascript's alert()
meteor-platform 1.2.2* Include a standard set of Meteor packages in your app
meteorhacks:cluster 1.6.9 Clustering solution for Meteor with load balancing and service discovery.
meteorhacks:kadira 2.22.0* Performance Monitoring for Meteor
meteorhacks:npm 1.5.0 Use npm modules with your Meteor App
meteorhacks:ssr 2.1.2 Server Side Rendering for Meteor with Blaze
meteortoys:allthings 1.2.1* Insanely Handy Development Tools for Meteor
mquandalle:jade 0.4.3* Jade template language
mrt:accounts-admin-ui-bootstrap-3 0.2.7+ A roles based account management system using bootstrap 3
mrt:cron 0.0.1 Simple meteor.cron
mrt:jquery-masonry 0.1.0 jQuery Masonry repackaged for Meteor
mrt:moment 2.8.1 Moment.js, a JavaScript date library for dates, packaged for Meteor. See http://momentjs.com.
mrt:moment-timezone 0.2.1 Timezone support for moment.js, packaged for Meteor. See http://momentjs.com/timezone.
multiply:iron-router-progress 1.0.1* Progressbar for iron:router
natestrauser:font-awesome 4.3.0* Latest version Font-Awesome loaded via CDN
natestrauser:select2 3.5.1* Select2 is a jQuery based replacement for select boxes.
npm-container 1.2.0+ Contains all your npm dependencies
praxie:canvas-to-blob 1.1.1 JavaScript Canvas to Blob is a function to convert canvas elements into Blob objects
random 1.0.3* Random number generator and utilities
rcy:nouislider 7.0.7_2 noUiSlider is a lightweight jQuery range slider plugin
reactive-var 1.0.5* Reactive variable
reywood:publish-composite 1.3.6* Publish a set of related documents from multiple collections with a reactive join
risul:bootstrap-colorpicker 2.2.0 Bootstrap Colorpicker: http://mjolnic.com/bootstrap-colorpicker/
sacha:spin 2.3.1 Simple spinner package for Meteor
skinnygeek1010:validate-form 0.3.0 A micro form validator
stylus 1.0.7* Expressive, dynamic, robust CSS
themeteorchef:bert 1.1.0 Client-side curmudgeon for Meteor.
tsega:bootstrap3-datetimepicker 4.14.30_4 Bootstrap 3 DateTime picker from #Eonasdan, packaged for Meteor.js
twbs:bootstrap 3.3.5 The most popular front-end framework for developing responsive, mobile first projects on the ...
woody:stripe-easy 0.1.0+ Subsciptions with Stripe made easy for Meteor.
yogiben:pretty-email 0.0.6 Send pretty emails
zimme:collection-timestampable 1.0.9 Add timestamps to collections
zimme:select2-bootstrap3-css 1.4.6 CSS to make Select2 fit in with Bootstrap 3
It works now. I just had to wait sometime. I think the meteor package server was down. So it was just waiting. If this happens to you just wait some time and try again.
I had the same problem (tried waiting or kill/re-running repeatedly) and I checked the status of the meteor package server, which was operational. However, after I ran "meteor list" something must have changed because "meteor update" ran fine. Could have been a coincidence but thought I'd share in case it solves the issue for someone else.

How do you see logging from a Meteor Cordova iOS app?

From what I understand, doing a console.log in a normal Cordova app gets piped to the Xcode debug output, but that doesn't work for my Meteor Cordova iOS app, so I've been doing alerts, which isn't as good.
#Ethaan's answer is a good point, but I don't think it is answering the OP's intended question. I am going to re-iterate the comment from #user728291 on the Question since I believe it is the sought answer.
Safari Remote Debugging will show you console.log messages from
Xcode's simulator or a connected device.
And in the case that the hyper-link may someday be moot, I will re-iterate the referenced text from the link:
If you are doing iOS PhoneGap debugging and have the Safari Develop Menu enabled, you can access the currently active session through the built-in Safari Web Inspector. To activate, go to Develop -> (iPad || iPhone) Simulator (normally, the third menu item) and click the active session you want to connect to. Voila!
The same way you can use Meteor.isServer and Meteor.isClient booleans
to separate your client-side code and server-side code, you can use
Meteor.isCordova constant to separate your Cordova/Phonegap-specific
code from the rest of code shipped to browsers and mobile devices.
From Meteor Cordova Phonegap Integration Documentation
So try with this.
if (Meteor.isCordova) {
console.log('Hi iam on the console from Xcode")
console.log("Welcome back " + Meteor.user().username);
console.log("the user with the id " + Meteor.userId() + " Just logged In");
}

Resources