Extending Xamarin Forms

XamerinFormsPart2

This is Keith’s second part to his earlier session on Introduction to XAML Forms.

Below are my in-session notes:

  • JetBrains dotPeek is a Windows app to help with XAML.  Extremely valuable according to Keith.
  • Demo was in Xamarin Studio (on Mac).  A little more stable than Visual Studio 2015 right now.
  • When starting new project, you have check boxes for target platforms (iOS & Android).
  • UITests projected created for you, by default.
  • Be sure to get latest packages because they’re updated frequently.
  • Creating a new XAML form creates a XAML file and a C# code behind file.
  • Inside XAML <ContentPage>, type in your new controls.
  • He created an Audio Recorder class to record some audio.
  • He’ll be targeting iPhone for this demo.
  • Data binding with BindableProperty type:
    • public static BindableProperty fileNMeProperty = BindableProperty.Create(“FileName”, typeof(string));
    • public string FileName{ get{ return (string)this.GetValue(FileNameProperty);} set{this.SetValue(FileNameProperty, value);}
  • MessagingCenter class lets you communicate between the layers (I presume he means between the code behind layer and the XAML layer).
  • C# code that’s native to the target platform is auto-generated (I think).
  • He built and deployed his demo to his iPhone and recorded his voice.  We didn’t hear the playback, but he swears it played back.  Don’t worry, we trust you Keith. 🙂
  • He created a “renderer” for a platform specific feature (>> on list items on iOS).  It will not fail on other platforms, it just won’t show it.

Introduction to Xamarin

CodeStock 2015 is the biggest CodeStock, by almost double this years hosted at the Knoxville World’s Fair park Convention Center.  It’s our first year having it at this convention center.  Below are my notes on the intro to Xamarin Forms session.

Xamarin is a cross platform development tool to let you write mobile apps once and deploy to Android, iOS, or Windows Phone.  It’s not from Microsoft, but it’s a .Net platform that allows you to write  your code in C# (and now supports F#).  Below are my in-session notes.

IMG_20150711_105821

 

  • Xamarin FORMS adds shared UI Code (this is new) – No more platform specific.
  • Xamerin has been around since 2000, so not a new or fly by night company.
  • They negotiate on pricing.
  • You have to pay TWICE if you want BOTH iOS And Android. UGH!
  • Xamerin forms is only for Enterprise. DOUBLE UGH!
  • Mac is required for iOS. TRIPPLE UGH!
  • Cloud testing available
    • Automatically test your app on hundreds of mobile devices. Select what to test on. They have a room in Europ filled with hundreds of phones and tablets.
    • Captures screen shots, etc…
  • Xamarin University – $1,995 per developer – Instructor live training. Free for a month right now – but there’s a catch. Only 2 of the courses are available
    • intro – what we’re about
    • and very first one (how to use it)
  • Paid gives you 3 months access to business tier – because you need it to go through the training.
  • Not only can you use C#, but you can also use F#.
  • You HAVE to know the specifics of each platform (iOS & Android)
  • Tools
    • Xamarin Studio (PC or Mac)
    • Visual Studio plugin for VS 2010 and higher (requires biz or enterprise or starter, just not indie)
  • If you want to build for Windows Phone, you have to have Visual Studio.
  • Xamarin Studio doesn’t support iOS
  • VS supports both iOS and Android
  • Xamarin Android Player (emulator) faster than Google’s. Runs on Windows & OSX
  • They have a few images (Lollipop image is available)
  • Doesn’t work well with Windows Phone emulator.
  • Xamarin supports Android Wear, Apple Watch, & Microsoft Band
  • about 90% of code can be shared across platforms
  • PCL = Portable Class Libraries used for the “core” code in multi-platform applications.
  • About 80% of a Xamarin Forms app will be located here.
  • Rosylin compiler already supported in Xamarin.
  • Xamarin Forms
    • Xamarin UI controls are an abstraction above each platform’s native controls, but compile down to platform specific controls. Provides a native experience on each platform.
    • Layouts are common screen layouts that you can choose from.
    • Yes, you can nest layouts in them.
    • Forms made with XAML. — MVVM as a result.
    • Can also do it with code.
    • Extensibility
      • Can embed custom views anywhere.
      • Call platform APIs via shared services.
      • You can go full native API if you want (kind of defeats the purpose of using Xamarin though)
  • Custom Renderers
    • You can override a renderer for a specific platform.
  • Xamarin Forms
    • Reflection will be a problem on iOS because there’s no runtime on iOS.
    • App Quality control
    • Xamarin Insights
      • Real time monitoring, track crashes, know of user problems before they report, get user’s e-mail address, etc…

 

Shovelware on your phone

Screenshot_2012-07-23-20-15-08Do you use the pre-installed software that came on your phone?  I don’t mean the popular stuff like Google Maps and such… I mean the proprietary stuff… the stuff from your Carrier like T-Mobile or Verizon?  Or the stuff from your handset maker like Samsung or HTC?   For example:

Getting started with S Memo

Not to pick on Samsung or their reportedly “good” app “S-Memo”… That’s one of many examples.  Usually proprietary software sucks or costs money to use or sux AND costs money to use.  But, sometimes, some of it is quite nice.  That’s purportedly the case with Samsung’s S-Memo, but I’m not here to promote that software.

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

In fact, regardless of how nice it might be, I’m choosing to not even bother with it.  And, there’s an important reason why:

It’s not available on other phones and never will be!

One of the draws of the Android platform is that it’s hardware agnostic.  That means, I can run Android on a plethora of devices from an almost countless number of hardware providers and software written for Android will wok on the vast majority of them.  Why would I want to get mired down in an app that I cannot take with me when I decide to switch to another phone?  That would be like buying a Dell computer with a proprietary spreadsheet app that’s not compatible with Excel or LibreOffice.  Then, if I want to buy say, an HP computer, I can’t use the Dell spreadsheet app or the spreadsheets I created with it.  What’s the point?  Specifically, what’s the point for ME?  I can see the point for Samsung… If I start using it, it locks me into their hardware.  But that doesn’t help me or you.

So, regardless of how awesome it may be, I’m just simply not going to use it.  There are PLENTY of other note taking apps out there like ColorNote, OneNote, EverNote that are NOT tied to one maker’s hardware

What about you?  Do you use any of the proprietary software that came with your phone?  If so, what do you use and what are your plans for making the switch to another phone at some point in your future that doesn’t provide it?

CodeStock 2012: Adaptive and Responsive Web Design

imageBelow are my notes taken during CodeStock 2012’s “Adaptive and Responsive Web Design” hosted by:

Steve Bodnar ( @SteveBodnar )
www.geeksandgurus.com

 

 

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

In this session we learned how HTML5 lets us design our web apps to automatically adjust to all sorts of different sized browsers.  See links in notes below for sites with examples.  Resize your browser to large and small and watch the sites automatically adapt.

Raw notes, as I typed them in class below:


  • How to make your sites work on any HTML/Javascript device regardless of browser or device.
  • RELEVANT CONCEPTS
    • App vs. site
    • Graceful degradation
    • Progressive enhancement
    • Others…
  • GRACEFUL DEGRADATION
    • Downgrade gracefully when features aren’t available in browser. User should not notice.
    • Design on most advanced browser then adapt to lower browsers
  • PROGRESSIVE ENHANCEMENT
    • Focused on content, not browsers
    • Builds for least capable devices
  • STRAGEGIES
    • Start with lowest
    • Design for semantics and structure
    • Add features appropriate for baseline devices
    • Add features appropriate for accessibility
    • Add layout markup and style sheets for structural layout
    • Add baseline presentational style sheets using link
    • Add behavior (scripts, css hover, etc.)
    • Add workarounds/hacks for recalcitrant browsers
    • Define styles for modern graphical browsers.
  • ADAPTIVE WEB DESIGN
    • Not clear divide between this and response web design. Responsive is more specific
    • Creating interfaces that adapt
        • (use firefox user agent switcher to render as other devices)
        • Using progressive enhancement
        • Examples of adapting
          • If device can access location, enable location-based behavior
          • If device supports touch, enable touch-friendly ui
          • If device supports html5, use it
        • Mobile First
  • RESPONSIVE WEB DESIGN
    • Fluid Grids
    • Fluid Images and Media
    • Media Queries
    • (site takes shape of browser).
    • MediaQueries.es for examples of adaptive web design.
    • ASP.NET MVC 4 provides adaptive in default project.
    • @media keyword in CSS.
    • Resolution independence
  • MOBILE FIRST
    • Embrace constraints, don’t fight them.
    • Ony eyeball, one thumb
      • Forces you to focus
        • What content must be delivered?
        • Is chrome necessary?
        • Rich context aware applications.
  • ACCESSIBILITY
    • Design for all visitors
      • Screen readers
      • Color blindness
      • Hearing impaired
      • Navigation, images, forms
    • Not just about design for people with disabilities
  • BROWSER GRADES
    • C-Grade
      • Based level of support
      • Identified, incapable, antiquated and rare
    • A-Grade
      • Highest level of support
      • Identified, capable, modern and common
    • X-Grade
      • Unknown, fringe or rare browsers as well as browsers on which development has ceased.
  • TOOLS
    • CSS
      • Embrace CSS
        • CSS Zen Garden csszengarden.com
          • Links on right switch CSS to completely change the site with zero HTML change.
        • CSS1k.com
          • Examples of what 1KB of CSS can do to how a website looks.
  • HTML5
    • Clark Sell and Brandon Satrom
    • Microsofties
    • At CodeMash
    • HTML
    • CSS3
    • JavaScript
    • Semantic HTML
      • <div>
      • <div id = “header”>
      • <header>
      • <article>
      • <time>
    • Data attributes
      • Any attribute that starts with “data-” will be treated as a storage area for private data
      • <data-role>
      • <data-role = “header”>
      • <data-role=”footer”>
    • Viewport (browsers tell you what resolution they can handle – phones will lie)
      • Visual Viewport
        • The part of the page that’s currently on-screen
      • Layout Viewport
        • Doesn’t change in size or shape
        • Varies per browser
  • MEDIA QUERIES (w3 site has it all)
    • Width
    • Height
    • Device-width
    • Devbice-height
    • Orientation
    • Aspect-ratio
    • Device-aspect-ratio
    • Color
    • Color-index
    • Others.
  • FRAMEWORKS
    • MVC 4
    • Twitter bootstrap twitter.github.com/bootstrap
  • EVERYONE AGREES
  • Emulators
    • Shrinking your browser isn’t a perfect example.
    • Use real emulators if you have them.
    • Android-emulator.org
      • Has emulators for multiple mobiles including Ios
  • RESOURCES
    • Alistapart.com
    • Css3pie.com – to get IE 6-9 capable of rendering several of the most useful css3 decoration features.

New to Android? Here’s what you need!

Starting in a new computing environment can be confusing and stressful for many reasons.  I’ll provide you the knowledge base, the apps, and the community resources you’ll need to have a good experience on your new Android device.

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

(Image Credits: https://www.aimagin.com/products/training/android-beginner-workshop-reviews.html)

Android is more than just an OS (Operating System) or “a phone”.  It’s an ecosystem made up of the OS, the phones, as well as tablets, TVs, computers on a stick, notebooks, wrist watches, health monitors, appliances, a platform, a community, a mindset, and the whole is greater than the sum of the parts.  So, with your new Android device, you’ve moved into a whole lot more than just your new phone (and I’m making a wild assumption that your new device happens to be a phone as it could have been any of the items listed above, or even something else).

There’s a LOT I could talk about here, but since this is focused on just what you need to get started, I’ll try to hold myself back.  I’ll also restrict this discussion to just phones and tablets.

What’s Not unique about Android?

Let’s begin with what you’re familiar with.  You’ve probably used a smartphone or a tablet by now.  If not, you’ve certainly used a Windows, Linux, or Mac based PC before.  Android is somewhat similar to those in that it provides you with a GUI (graphic user interface), usually on a mobile device.  That user interface is optimized for touch input.  You have the familiar things you’d expect in any GUI such as buttons, lists, check boxes, etc…  Being optimized for mobile devices, it also has video keyboard support, and of course, support for touch screens.

Since it is an OS, you also get app stores and apps which can take advantage of the capabilities of your mobile device.  Most mobile devices have many (if not all) of the following hardware capabilities:

  • Touch screens
  • Speakers
  • Microphones
  • Cameras (both snapshot and video recording)
  • Wireless network capability
  • Mobile service radios (cellular network capable)
  • GPS
  • Compass
  • Physical keyboards (with real buttons)
  • Expansion slots for more memory
  • data/power ports
  • NFC (Near Field Communication) chips
  • Thermometers
  • Barometers
  • Bluetooth communication

among other features.

What’s Unique about Android?

There are many things unique to Android, but seeing as this is a beginner’s guide, of sorts, I’m just pointing out some of the highlights.

Android separates itself from the others in that it is an open system.  This word “open” has multiple meanings.  In one sense, it means that the source code to the OS is available for any programmer that wants it to make changes to the underlying capabilities.  It also means that anyone is free to make modifications to it and sell their own hardware running the Android OS.  But, what does that mean for YOU?  After all, most people are NOT programmers nor hardware manufacturers and have no desire to be.  So how does that help YOU?

Since Android is free for anyone to use, there is a plethora of Android devices on the market.  You’re not limited to just ONE or a small handful of models to choose from.  What ever form factor you want, there’s one (or probably many) available that fits your needs running Android.  If you must have a physical keyboard, then there are many many Android phones and tablets with physical keyboards, as one of many examples.  There are devices with large screens, with small screens, with hi-res screens, with low res screens, with sturdy, expensive hardware, with cheap hardware, with hi end devices, with low end devices, and everything in-between, expensive devices, and budget devices.  Whatever your cost budget or your hardware needs, there’s a device for that.

It also means you’re not limited to getting your hardware from just ONE company.  You’re not limited to just one or a small handful of cellular providers.  Android devices are available everywhere.

Another notable feature is that you’re not locked into a single app store.  You can install apps from where ever you like.  Apps also register their capabilities with the OS.  In other words, Facebook, Google+, and Twitter, when installed, announce to the OS that they are capable of sharing content.  So, whenever you use an app that’s capable of sharing content, like a browser sharing a link, or a photo app sharing a photo, when you tap the “share” icon in whatever app you’re using, ALL the apps you have installed that are capable of sharing content will appear to let you choose which app or service you want to use to share that content.  The great part about that, aside from the obvious, is that apps don’t have to be written specifically to “know” about all these services.  They only have to be written to tell Android they have content to share and to hand it over to Android.  Android then passes it along to the app or service that the user chose from the list and that chosen app or service takes it from there.  Neither the original app that created the content, nor the app that received and published it need to know anything about each other.  That’s all handled by the Android OS.  This makes capabilities of apps sharable between apps without any app needing to know anything about any other app.  Say, for example, you install some obscure photo editing app, then 3 years later, some new social network shows up and provides an Android app.  Your 3 year old photo editing app, that you may not have even updated, can easily share to the new social network that didn’t even exist 3 years ago when you installed the photo editing app.

What can I do with an Android device?

You can do pretty much the same things you can do with most other, modern, mobile devices.  You can make and receive calls (if your device is a _phone_ of course, or is internet enabled and has a microphone and speakers), browse the web, download apps, calendar, contacts, games, finances, social networking, GPS, etc… etc…

What do I need RIGHT NOW?

Security:

As with any computer system, the first thing you need to do is to secure it.  In spite of popular belief, Android is NOT less secure than iOS. In fact, if you use it right, it’s MORE SECURE THAN iOS!  These are the security issues you’ll encounter on a mobile device (ANY mobile device, regardless of who makes it or what OS it’s running):

  • Hardware loss or theft.
  • Exposing your private data like contacts, phone log, browsing history, social networking posts and friends, E-Mail, credit cards, bank accounts, web site logins, home address, work place, children’s names and ages and schools, etc…  Anything you access on the internet via your phone and any data you enter into your phone, including where you are now (GPS) and exactly where you were at any given point in time.
  • Malware.

Install Lookout Mobile Security right now.

Lookout Security & Antivirus

It will help with all of these issues.  Another good one (but doesn’t check for viruses) is Cerberus anti theft.

Cerberus anti theft

Cerberus is also great for keeping track of your kids’ where-abouts.  One of my children recently when on their first out of town, over night, field trip.  I was able to check in to see where they were at an given time.  I could even see them driving down the road on a map.  It’s a great peace of mind.

Communication:

There are multiple ways to communicate with people with a mobile device:

  • Phone call
  • Text/SMS
  • IM
  • Social Networks like Google+, Twitter, Facebook, etc…

I highly recommend installing Google Voice (NO! NO! NO! NO! NO! NO! NO! Despite it’s name, it’s NOT to reduce your cell phone minutes!!!! It’s for everything BUT THAT!)

It never fails!  Every time I mention Google Voice to someone, they always respond with, “Well, I’ve got unlimited minutes, so it’s pointless.”   Jeesh!  It’s NOT FOR THAT!  It’s a poorly named service because “voice” is NOT what it provides.

Google Voice provides the following features:

    • Instant Messaging (Google Chat)
    • Instant Messaging with voice.
    • Instant Messaging with video.
    • FREE TEXTING!!!!  (Again):  I must constantly battle the next response I always get, “But I have unlimited texting”.  Most likely you’re paying extra for that service.  I recommend dropping that and asking your cell provider to block all texting (so you don’t get charged for spam messages).  Then, you can continue using texting COMPLETELY FOR FREE!!!!!!  See this article:

Google Voice: Free, unlimited texting on your cell/mobile phone!

DON’T install the Facebook app!

Facebook is notorious for continuously, without end, violating your privacy on multiple levels.  I personally recommend staying away from Facebook altogether, but if you just can’t pull yourself away, at least access it from your mobile via your web browser ONLY… NOT via the mobile app.  Just do NOT install it.  The app itself has been found to violate your privacy.  You DON’T want it on your phone!

Also, when you access the Facebook website, be sure to put “s” after the “http” in the browser’s address bar.  In other words, your browser should be at https://www.facebook.com with an “s” in there after the “http”.  Otherwise, you’re on an UNENCRYPTED PAGE where you’ll be entering your login name and password in clear text, broadcast over the internet, and possibly in the clear over the wireless network at Starbucks or the library or your school or anywhere else (one of the many problems with Facebook security and privacy).  This is NOT an Android issue, it’s a Facebook issue! 

Now, back to Google Voice.  I did say that the purpose of the Google Voice app has NOTHING to do with making free phone calls from your mobile phone.  And I stand by that.  But, there ARE other apps available that WILL give you free phone calls (and they do it using your Google Voice account).  They do this by using VOIP (Voice Over Internet Protocol).  In other words, they communicate over your cell provider’s DATA network as opposed to its VOICE network.  You get charged from your allowed minutes if you use their VOICE network, but NOT if you use their DATA network.  Be careful though, because it DOES use bytes on your data plan, so if you have a LIMITED data plan, you’ll want to keep track of your data usage… but digitized voice over data is a pretty low bandwidth usage. 

Again, if you tell me you get unlimited minutes again, I’m going to slap you silly!  You might be one of the few that doesn’t have to pay extra for unlimited voice.  But, if you’re in the majority, you’re paying EXTRA for unlimited voice.  With the right apps installed, you can drop the cost of your monthly bill down considerably by getting their lowest minutes plan and blocking text messaging.  I’ve already covered free texting above.  Now, here’s how you get free minutes for phone calls too:  Free Cell Minutes.  As an example, I have 5 phones on my plan and 4 of them have unlimited data.  We have the lowest possible plan we can get as far as minutes go (750/mo. shared with 5 people).  My Total bill each month?  $144.  And because of how we’re using Google Voice appropriately, we end up having unlimited voice, text, and data on 4 of the 5 lines.  (The 5th line is for my aunt who simply wants a plain old phone).  Most people I know can barely keep ONE phone below $144/mo.  As you can see, using this right saves you TONS of money.  If you’re wondering… I use T-Mobile.

That’s about all you Need right now, but there’s plenty more you’ll likely want and I’ll cover some of those on an ongoing basis, so keep checking back and follow me on Google+.

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

See these images?

imageimage

You’ll find an actual working versions of them at the top and bottom of this article. Please click the appropriate buttons in it to let your friends know about this article.

Check back later for updates too!

Understanding the Android App Store: ArsTechnica.com doesn’t understand it nor risk vs freedom

imageIn this story on ArsTechnica.com, I find it funny, annoying, and pointless that people point out that there are some malware apps in the Google Android app store. The Google app store (now called “Google Play”) is nothing more than a consolidated place for apps that would otherwise be available on the creator’s on web sites. But, unlike the web, Google can and does take down apps that are proven to be malicious. Just like on Windows, it’s the user’s responsibility to not download junk from sources they don’t trust and to use common sense. It’s the difference between freedom on an open system vs. a closed system. With freedom, there are risks. With a walled garden, there are fewer risks (not zero), but much less freedom. Each has its own merits and no one can be blamed for which they choose. I personally choose freedom. I’m a big boy and I’m educated and can manage my own risks. But that’s just me.

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

See also:  Understanding what Android actually IS

Take this quote from the ArsTechnica.com story:

“The apps, which were reported here by McAfee researcher Carlos Castillo, masqueraded as video players offering trailers of Android games and anime content. In the background and without warning, they also obtained the phone number and a unique identifier of the infected device and sent the information in clear text to a remote server under the control of the software developers”

Whenever you install an Android app, you’re given a list of the phone’s data and features the app is requesting access to from the OS. So, I call bull sh!t on “and without warning”. If you’re downloading a video player and the app store says it asks for access to your contacts, you simply refuse to let the app be installed. I have refused the installation of several apps based on this simple logic — apps whose function has nothing to do with what it’s requesting access to. Simple. BTW, the “unique identifier” is normal for all apps that have ads to support them. Not much different than a web site getting your IP address or a Windows/Mac/Linux desktop app that sends your MAC address and/or other hardware IDs, but unlike Windows/Mac/Linux desktop apps, Android apps can’t be installed without you being told, point blank and openly, what they’re requesting access to from the OS.

Pointing out that there are malicious Android apps is no more relevant than pointing out there are malicious Windows apps or malicious Mac apps or malicious Linux desktop apps. Yep. We know that. That’s the price of freedom — risk. And, for people that “don’t know any better”… I call BS on that too since the app store shows you what any Android app you’re about to install is requesting access to. It’s usually a very small list and takes only seconds to see and decide. I have no pity for morons that blindly click “Allow” and neither should you. If you’re intelligent enough to read and install an app, you’re smart enough to decide if a video player should have access to your contacts.  Hint:  The answer is “NO!”

Click here to follow me on Google+.

Follow me on Twitter @CSharpner.

See these images?

imageimage

You’ll find an actual working versions of them at the top and bottom of this article. Please click the appropriate buttons in it to let your friends know about this article.

Check back later for updates too!