<head>
<title>mobile-render-test</title>
</head>
<body>
{{> home}}
</body>
<template name="home">
{{#if Meteor.isCordova}}
{{> mobile}}
{{else}}
{{> web}}
{{/if}}
</template>
<template name="mobile">
<h1>Cordova</h1>
<p>This is rendered in the mobile device.</p>
</template>
<template name="web">
<h1>Web</h1>
<p>This is rendered in the web browser.</p>
</template>
I use “meteor run android-device” and I can access it at localhost:3000 in a web browser as normal, and it shows me Web - This is rendered in the web browser", but on my Android device, it shows exactly the same ie: “Web - This is rendered in the web browser” instead of “Cordova - This is rendered in the mobile device”
What am I doing wrong?
My Android device is a Samsung Phablet SM-T705Y (tablet phone)
Could it be registering as having a larger screen than a phone? Its a 7" phablet, not an iPhone etc.
It gives the same “Web - This is rendered in the web browser” when running on my Samsung Galaxy Tab SM-T530
And another aside, just adding that to an already running project, does not update the client device.
You have to ^C and restart with meteor run android-device
That’s what I found. Hope this was helpful for someone.
It is best to have all templates, and JS files for templates (helpers etc…) within a folder called ‘client’ so that you don’t need the conditional code to check if its the client.
Also means the server won’t have that code packaged and skipped over constantly.
Thanks for that tip Chris. This was just a proof of concept not a working app - just to get a feel for it all, but yes you’re right.
How’s Sydney? Have you ever been to a Meteor Meetup there?
Cheers
Brad
No worries, took me a while to get my head around files and folders and what I thought worked best for me. Wasn’t sure if you were still testing the waters
Yeah Sydney is Amazing this time of year, cold but beautiful.
Never been to a meet-up before.