Meteor + Cordova + Logging

How do I view logs in Meteor + Cordova? I’m having a bunch of problems with my build and have zero idea on how to debug things in AVD or simulation. Any help would be huge.

It is pretty easy: use the remote debugging features of Chrome and Safari (on your desktop PC). Both allow you to connect to your mobile device and inspect it as if the app was running in your desktop browser. Should work with the simulators, too, but I prefer debugging right on a physical device.

Ah, got it.

This follow up is a bit tangential, but have you ever seen Meteor on mobile/Cordova simply not load the data, and/or possible not run Handlebars properly. In my case, none of the loops seems to run/none of the collections in the loop is being returned, and helper conditionals all seem to be missing. Ever come across that? No errors in the console.

What exactly do you mean by “loops”?

Each loop.

{{#each genre in genres}}
    <p>{{genre.name}}</p>
{{/each}}

Now I’m stuck, either the collections aren’t being returned, or spacebars isn’t doing its thing. Helpers that should be turning bools seem to be returning nothing at all.

Can you post the JS code of your template? Normally, Blaze is quite reliable and complains heavily if something is broken. I guess you didn’t setup your template’s JS code correctly and it is not run at all.

Yeah, drilling down, Blaze seems to be working. Putting in a helper method I’m getting a return value that’s working. So where I seem to be having problems is getting the collections to return. Works locally and on web (Galaxy), doesn’t work on simulator. No errors in the console, but no data returned.

... 

  // Get the stories
  banners: function(){

    // Get the stories for the genre
    var banners = [];

    // Loop through the banners
    Stories.find({}, {limit:10}).fetch().forEach(function(e){

      // Add a style to the story
      e.font = genres[e.genre].font;

      // add this object to the list of banners
      banners.push(e);

    // banners foreach
    });

    // Return those stories
    return banners;

  // banners
  }

...

CORS?

...

  {{#if Template.subscriptionsReady}}
    <span id="pageHome">
      <div class="row slides">
        <div class="carousel carousel-slider main center">
          {{#each story in banners}}
            <div class="carousel-item white-text row" style="background-image: url({{story.image}});">
              <div class="col s12 m12 l6">
                <h3 class="white-text" style="font-family: {{story.font}};">{{story.title}}</h3>
                <p class="white-text" style="font-family: {{story.font}};">{{story.description}}</p>
                <p data-url="/story/{{story._id._str}}" class="toStory waves-effect waves-light btn white-text 500">Read</p>
              </div>
            </div>
          {{/each}}
        </div>
      </div>
      {{#each genre in genres}} 

...

You should check if your mobile app is able to reach your server. You put put log messages in the publications to see if it is being called. You can query the collections on the Chrome/Safari while debugging as well.

The publication spits out a log with the correct results. Just on iOS on Flow Router, does there seem to be no results.

If you don’t object to tutorial videos, I made one for setting up Android KitKat in a KVM virtual machine.

In 5½ minutes it shows the entire set up of Android x86, then installing and debugging a Meteor app.

Debug your Android App in a Virtual Machine

https://youtu.be/xB3wWvK5YT0&t=196s