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

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");
}

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.

CrossFirebasePushNotification.Current.RegisterForPushNotifications(); throwing NullReference iOS

to do push notifications in my Xamarin Forms App, I am using the CrossGeeks FirebasePushNotification Plugin. My android setup is working alright, but for the iOS app, when I try to run the app, the line
CrossFirebasePushNotification.Current.RegisterForPushNotifications();
is causing a NullReference Exception. What I have done to set up:
Set "FirebaseAppDelegateProxyEnabled" to "No"
Changed the GoogleService plist to Bundle Resource
Added the FirebasePushNotificationManager.Initialize(options, true); in the App Delegate (and it is saying it is unreachable?"
I am testing on a simulator but I believe this should only prevent the receiving of notifications, not the registering?
How would I solve this problem? In the documentation, it states that these are the steps needed for iOS setup.

Windows style dialog in iOS

I would like implement Custom alert view in iOS like windows dialog style(with Yes,No,Cancel in horizontal) and I have to publish the app in Appstore as well.
Application will get reject from Appstore if I do this customisation?
The approval process in Apple Store, is quite complex, but there is nothing saying that customizing a view will get your app rejected.
Check the guidelines for further information.

$authWithOAuthPopup() doesn't work on mobile

The following does not open a popup/new tab/do anything on Chrome 39.0.2171.50 for iOS 8.1.2 (12B440),
however it does seem to work on Safari on the same device:
<button ng-click="$auth.$authWithOAuthPopup('facebook')">Login with Facebook</button>
See plnkr: http://plnkr.co/edit/Ejd7fsyTHf6Ohn0F25Wy?p=preview
Is this a bug with Chrome or Firebase/AngularFire or am I doing something incorrectly?
I see from here that this may be a Chrome issue, however I can't get $authWithOAuthRedirect() to work either; see: http://plnkr.co/edit/9dd0W8X5k33LFBcCLmzs?p=preview
Both Popup and Redirect work on Desktop Chrome 39.0.2171.95
Firebase does not support popups are all platforms. In the event that an unsupported platform is detected, the authWithOAuthPopup() method will return an error with the code TRANSPORT_UNAVAILABLE, indicating that you should try to authenticate with a different transport, such as a browser redirect.
Iam not sure of ios but if you use android device along with ionic and firebase, run the following command to fix the issue:
ionic plugin add cordova-plugin-inappbrowser

Firefox webapp file input

I'm developing a webapp for firefox aurora (android). And i have an file input.
But when users click on the input they can't choose files from sdcard or filesystem only pictures, music or videos.
I search at MOZILLA DEVELOPER NETWORK, but couldn't find anything helpful.
In my manifest.webbapp i have device-storage permission:
"permissions": {
"device-storage:sdcard":{ "access": "readonly" }
},
I assume you are currently simply using the markup ?
The device-storage:sdcard is for a very different set of use cases really. And we don't have that implemented on Firefox for Android yet.
The list of applications being shown is just the set of applications that we're getting from the Android Intents system. I would imagine that if the user has some sort of filebrowser app installed it might respond to that intent and it'd pop up there.
But of course that's not something you can rely on in your app.
I'm honestly somewhat surprised that there's no default applications on android that provide that functionality, but I guess that's how it is. Or does someone know of a way to also get a filepicker intent that we can hook up to?
Medium term you will be able to use the DeviceStorage API. This will give you direct JS access to the sdcard which will allow you to build your own UI for choosing a file from the SD card. But that extra power comes with quite a few downsides. It's a privileged API which means that you'll have to write the app as a packaged app and you have to use CSP. And you'll have to go through the Firefox marketplace review process (all privileged apps have to go through code review).
So it's a pretty distant second choice.
Other than that there aren't any solutions. The best would of course be if there was a way we could plopp up an Android file picker, but I'm not sure if that's doable. And it's definitely not implemented yet.
According to the source code, this permission is only granted to apps that are packaged and privileged, the latter also means the app has to be signed by the Marketplace.
You can find more about packaged apps and privileged app types here:
https://developer.mozilla.org/en-US/docs/Apps/Packaged_apps
Just install an Android file manager app (https://play.google.com/store/search?q=file+manager&c=apps) and you will be able to select files from the SD card. There is no need for specific rights because this is handled automatically by the standard file input.
Accessing the SD Card can only be achieved through a privileged or certified app. Currently to my knowledge, there is no integration the system menus as you are hoping would be the case. Personally, I'm hoping that this will change.
API Documentation: https://developer.mozilla.org/en-US/docs/WebAPI/Device_Storage
You could create your own menu that mimics the the system one; in this way the user gets a seamless experience and they don't know the difference. It would require a little boilerplate though it's not insurmountable levels of boilerplate.
A quick snippet for browsing/enumerating all photos on the the SDCard:
var storage = navigator.getDeviceStorage("sdcard");
sdcard.browse = function () {
var pics = navigator.getDeviceStorage('pictures');
// Let's browse all the images available
var cursor = pics.enumerate();
cursor.onsuccess = function () {
var file = this.result;
alert("File found: " + file.name);
// Once we found a file we check if there are other results
if (!this.done) {
// Then we move to the next result, which call the cursor
// success with the next file as result.
this.continue();
}
}
cursor.onerror = function () {
alert("No files found: " + this.error);
}
};
If you would like some more details for reading, writing, and caulating available storage, I'm currently working on a little wrapper library in my spare time to work with the SDCard more easily (and handle some callbacks to integrate better with other code) in my spare time and can probably help you out.

Resources