iPhone

Sending Mobile Push notification using C#/.NET (iOS, Android, Windows Phone 8, Windows 8 and Blackberry)

August 9, 2013 .NET, ANDROID, Blackberry, Extensions, iOS, iPhone, KnowledgeBase, Microsoft, Microsoft SDKs, Mobile, Mobile Services, Mobile-Development, Nokia, Third-Party-Libraries and Frameworks, VisualStudio, VS2010, VS2012, Windows, Windows 8 apps development, Windows Phone, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Phone Store, Windows SDK, Windows Store, Windows Store Development 2 comments

This is an update blog to my earlier blog about Sending Apple iOS Push notifications using C#.

With that blog – I  introduced you to  how to send push notification using Open Source library APNSharp, by the developer John Redth.  Redth announced that library is already deprecated.

Redth came up with  with another open source project called as PushSharp:,published under apache software foundation license.

PushSharp is a server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM – Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!. Single library serves the purpose of sending push notifications to multiple platforms. Pretty decent isn’t it?

Here is the basic  architecture:

image

Features of PUsHSHARP

  • Supports sending push notifications for many platforms:
    • Apple (APNS – iPhone, iPad, Mountain Lion)
    • Android (GCM/C2DM – Phones/Tablets)
    • Chrome (GCM)
    • Amazon (ADM – Amazon Device Messaging)
    • Windows Phone 7 / 7.5 / 8 (including FlipTile, CycleTile, and IconicTile Templates!)
    • Windows 8
    • Blackberry (BIS and BES via PAP)
    • Firefox OS (Coming soon)
  • Fluent API for constructing Notifications for each platform
  • Auto Scaling of notification channels (more workers/connections are added as demand increases, and scaled down as it decreases)

Implementation using PushSharp is straight forward

Here’s some sample code: shared by Redth

//Create our push services broker
var push = new PushBroker();

//Registering the Apple Service and sending an iOS Notification
var appleCert = File.ReadAllBytes("ApnsSandboxCert.p12"));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "pwd"));
push.QueueNotification(new AppleNotification()
                           .ForDeviceToken("DEVICE TOKEN HERE")
                           .WithAlert("Hello World!")
                           .WithBadge(7)
                           .WithSound("sound.caf"));


//Registering the GCM Service and sending an Android Notification
push.RegisterGcmService(new GcmPushChannelSettings("theauthorizationtokenhere"));
//Fluent construction of an Android GCM Notification
//IMPORTANT: For Android you MUST use your own RegistrationId here that gets generated within your Android app itself!
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
                      .WithJson("{"alert":"Hello World!","badge":7,"sound":"sound.caf"}"));

You can get the Push Sharp for your .NET projects from below mentioned links:

Binaries from NuGet: https://www.nuget.org/packages/PushSharp 

To install PushSharp, run the following command in the Package Manager Console

PM> Install-Package PushSharp

Source Code from GitHub: https://github.com/Redth/PushSharp

Documentation and Implementation Guides available at wiki page: https://github.com/Redth/PushSharp/wiki 

Quick links to implementation guides

You can read my previous blogs here:

Sending Apple iOS Push notifications using C#

Apple Push Notifications Service API & C#

HTML5 Definition Complete, W3C Moves to Interoperability Testing and Performance

December 19, 2012 All, ANDROID, Community, CSS, CSS 3, HTML, HTML5, IE, IE10, Internet Explorer 10, iOS, iPhone, JavaScript, JQuery Mobile, KnowledgeBase, Mobile Frameworks, mobile web, Mobile-Development, MSDN, StyleSheets, Web No comments

The World Wide Web Consortium (W3C) has published —  the complete definition of the HTML5 and Canvas 2D specifications on 17 December 2012.

Quoting from the announcement here

  • Though not yet W3C standards, these specifications are now feature complete, meaning businesses and developers have a stable target for implementation and planning.

  • HTML5 is the cornerstone of the Open Web Platform, a full programming environment for cross-platform applications with access to device capabilities; video and animations; graphics; style, typography, and other tools for digital publishing; extensive network capabilities; and more.

W3C also announced today the first draft of HTML 5.1 and Canvas 2D, Level 2, an early view of the next round of standardization.

To reduce browser fragmentation and extend implementations to the full range of tools that consume and produce HTML, W3C now embarks on the stage of W3C standardization devoted to interoperability and testing (called "Candidate Recommendation"). Expecting the broad HTML5 Interoperability in 2014.

During this stage, the W3C HTML Working Group will conduct a variety of activities to ensure that the specifications may be implemented compatibly across browsers, authoring tools, email clients, servers, content management systems, and other Web tools.

  • The group will analyze current HTML5 implementations, establish priorities for test development, and work with the community to develop those tests.

  • The HTML Working Group has planned for this implementation phase to last into mid-2014, after which W3C expects to publish the final HTML5 Recommendation, available Royalty-Free to implementers under the W3C Patent Policy.

Sencha(Leading cross platform mobile framework product developer) – has published a blog on HTML5 readiness here

Quoting from Sencha’s report

Feature Standardization Status:

A long list of major HTML5 technologies has now reached advanced stages of standardization.

Here is a list of just some of the big technologies in advanced standardization status with the date of the most recent standard:

Candidate Recommendation:

  • CSS Multi-column (2011)
  • CSS Flexbox (2012)
  • CSS Values & Units 3 (2012)
  • CSS Backgrounds and Borders 3 (2012)
  • CSS Images & Replaced Content 3 (2012)
  • CSS Style Attributes (2010)
  • Web Storage (2011)
  • Web Sockets (2012)
  • Web Workers (2012)
  • Web Messaging (2012)
  • Touch Events

Proposed Recommendation

  • Geolocation (2012)

Full Recommendation

  • CSS Media Queries (2012)
  • CSS Selectors 3 (2011)
  • CSS Namespaces (2011)
  • CSS Color 3 (2011)
  • Media Fragments (2012)
  • SVG 1.1 (2nd Ed) (2011)

HTML5 Feature Implementation Progress in Browsers

The very good news is that HTML5 and CSS3 implementations across all major browsers on desktop and mobile have become increasingly convergent. The chart below shows the progress of HTML5 feature implementation across major desktop and mobile browsers in the last three years using the HTML5test.com scoring methodology.

Adoption on Desktop Browsers

HTML5 Support on Dektop Browser

Adoption on Mobile Browsers

HTML5 Support on Mobile Browser

HTML5 features have been rapidly adopted by all major browsers – with Internet Explorer’s progress on both mobile and desktop being particularly impressive. The feature implementation ramp from IE8 in 2010 to IE9 in 2011 to IE10 this year has been very steep.

Information Sources:

http://www.sencha.com/blog/html5-progress-report

http://www.html5test.com

http://www.w3.org/2012/12/html5-cr

Great News! for all Mobile and Web Developers

HTML5 – Bye Bye ‘WebSQL’/’SQLite’ – Welcome ‘IndexedDB’

December 18, 2012 All, ANDROID, Community, CSS, CSS 3, HTML, HTML5, IE, IE10, Internet Explorer 10, Internet Explorer 9, iOS, iPhone, JavaScript, JQuery Mobile, KnowledgeBase, Mobile-Development, MSDN, Web, Windows Phone, Windows Phone 8 No comments

Since November 18, 2010, the W3C announced that Web SQL database(Sqlite) is a deprecated specification. This is a recommendation for web developers to no longer use the technology as effectively, the spec will receive no new updates and browser vendors aren’t encouraged to support this technology. The new alternative is IndexedDB which is already available on Chrome 12+ and Firefox 5+, and, soon, in IE 10 as well.

The new web database standards adoption progress report as per Html5Test.com – how standards setting can work well.

  • WebKit browsers originally shipped a copy of the SQLite — an embedded relational database — and then proposed “WebSQL” as a specification to standardize it.
  • Mozilla objected to its standardization on the grounds that the SQL 92 standard was a poor basis for a web standards technology, and that an implementation (SQLite) shouldn’t be the basis for standard.
  • As a result, WebSQL standardization was abandoned in favor of a new database standard, IndexedDB which is now the standard database of record for all major browsers.
  • Firefox, IE and Chrome now support IndexedDB on the desktop.
  • Chrome for Android is the first browser to support it on mobile devices.
Category WebSQL IndexedDB
Advantages A real, relational database implementation on the client (SQLite). * Allows fast indexing and searching of objects, so in a web application scenario, you can manage your data and read/write it fast.
* A NoSQL database that let you work with your JavaScript objects and indexing them based on your application needs.
* Works in asynchronous mode with moderately granular locking per transaction. This allows you to work inside the event-driven module of JavaScript.
Disadvantages * The spec is deprecated.
* Overhead of SQL language you need to master and transform your JavaScript objects into relational schema
* Not object driven
Harder to understand if you are coming from the world of relational databases.
Location Tables contain columns and rows objectStore contains Javascript objects and keys
Query Mechanism SQL Cursor APIs, Key Range APIs, and Application Code
Transaction Lock can happen on databases, tables, or rows on ‘readwrite’ transactions Lock can happen on database ‘versionchange’ transaction, on an objectStore ‘readonly’ and ‘readwrite’ transactions.
Transaction Commits Transaction creation is explicit. Default is to rollback unless we call commit. Transaction creation is explicit. Default is to commit unless we call abort or there is an error that is not caught.

Ref Link:

http://www.w3.org/TR/IndexedDB/

http://www.html5rocks.com/en/tutorials/webdatabase/websql-indexeddb/

http://www.steveworkman.com/html5-2/standards/2011/the-limitations-of-websql-and-offline-apps/

http://www.html5rocks.com/en/tutorials/indexeddb/todo/

http://html5test.com/compare/feature/storage-sqlDatabase.html ( WebSQL – Current Support on browsers)

http://html5test.com/compare/feature/storage-indexedDB.html ( IndexDB – Current Support on browsers)

Introducing Monocross – A cross-platform MVC pattern for mobile development in .NET/C# and Mono

April 9, 2012 .NET, All, ANDROID, Frameworks, iOS, iPhone, Microsoft, Mobile Frameworks, Mobile SDK, Mobile-Development, Mono, OpenSource, Windows Phone, Windows Phone 7 2 comments , , , , , , , , , , , ,

I am evaluating different cross platform mobile development solutions. This is just a quick introduction to a framework I came across.

What is cross platform mobile applications?

A mobile application developed in such a way that it will work or run on most of the mobile platforms such as Android, iOS, Windows Phone, Blackberry etc.

What is Monocross?

MonoCross is a refinement of the Model-View-Controller (MVC) pattern for mobile development using .NET, C# and the Mono Framework.

The pattern enables cross-platform portability of business logic and data access code, (Model + Controller), while supporting full, native and/or platform-specific presentation (Views).

Read the MonoCross Roadmap for Platform support.

For more information on using the pattern, see: UsingMonoCross

 

Source: MonoCross project home http://code.google.com/p/monocross/

Mobile Application Development

April 7, 2012 All, ANDROID, CSS 3, HTML, HTML5, iOS, iPhone, JavaScript, JQuery Mobile, Mobile Frameworks, Mobile SDK, mobile web, Mobile-Development, Windows Mobile, Windows Phone, Windows Phone 7 1 comment , , , , , , , , , , , , , ,

Mobile Applications are rapidly developing segment in the global mobile sector. Developing mobile applications targeting different mobile platforms such as Windows Phone, iOS, Android, Blackberry and Bada(Samsung’s Proprietary OS) is the trend setter now.

Quoting from Wikipedia

Mobile application development is the process by which application software is developed for small low-power handheld devices such as personal digital assistants, enterprise digital assistants or mobile phones or smart phones. These applications are either pre-installed on phones during manufacture, downloaded by customers from various mobile software distribution platforms, or web applications delivered over HTTP which use server-side or client-side processing (e.g. JavaScript) to provide an "application-like" experience within a Web browser.

[Wikipedia]

Why is it so different from other application development?

Or

Why do we need to give special care when doing mobile development?

Mobile devices have certain limitations in terms of hardware, they have limited screen display, limited space for applications to operate and network capabilities. These limitations will vary in different models as the Mobile ecosystem is very large and there is innumerous amount of devices in the world. So we need to give special care in developing the mobile applications ensuring the compatibility across all the platforms.

Some of the things we need to consider when we do mobile development are:

  • Small screen size and mobile ecosystem – This makes it difficult or impossible to see text and graphics dependent on the standard size of a desktop computer screen.
  • Lack of windows/ multi-tasking – On a desktop computer, the ability to open more than one window at a time allows for multi-tasking and for easy revert to a previous page. Historically on mobile web, only one page can be displayed at a time, and pages can only be viewed in the sequence they were originally accessed. Latest mobile platform releases such as iOS, Android and Windows Phone are supporting multi tasking capability, which allows you to run more than one applications parallel, yet only one application can be displayed on the screen.
  • Navigation – Most mobile devices do not use a mouse like pointer, but rather simply an up and down function for scrolling or touch inputs, thereby limiting the flexibility in navigation.
  • Hardware and Resource limitation – all the upcoming mobile devices are having Dual Core or Quad core mobile processors with decent amount of memory. But still if you need you device to function well and be responsive, you should develop application in such a way it will be using low memory foot print.
  • Targeting Or Supporting wide variety Mobile Platforms/ Execution environments – this is the most complicated or important feature set we should be taking in to consideration when developing an application. Android, iOS, BlackBerry, HP webOS, Symbian OS, Bada from Samsung, and Windows Mobile support typical application binaries as found on personal computers with code which executes in the native machine format of the processor (the ARM architecture is a dominant design used on many current models).

Also read this article on 7 Limitations when designing for mobile: http://baymard.com/blog/mobile-design-limitations 

For Technical point of view we can differentiate mobile applications in to three categories

1. Native Applications

Native applications developed against native platform APIs and It would be having full(or limited for some platforms) access to the device capabilities. Each of the platforms for mobile applications also has an integrated development environment which provides tools to allow a developer to write, test and deploy applications into the target platform environment.

Examples are using Applications developed using Native/Platform Mobile SDK’s such as iOS SDK, Android SDK, Windows Phone SDK etc.  Windows Mobile, Android, HP webOS and iOS offer free SDKs and integrated development environments to developers. These applications will be able to utilize or interact with all device capabilities.

 

Five reasons for developing Native Applications:

  • Performance
  • Offline Mode
  • Findability / Discoverability ( through a central location such as Apple’s AppStore , Google’s Market, Windows Phone Market etc)
  • Device Attributes
  • Monetization

The disadvantage is obviously the development cost. No two mobile platforms can share the same mobile application, and there are too many Mobile operating systems (or platforms) existing in the market. If you develop a mobile application to market it widely, you need to develop that in  Symbian, Mac iPhone, Android, Blackberry and Windows mobile.

2. Mobile Web Applications  / Browser based Applications

Mobile Web applications are web sites that are scaled down/optimized to display on a mobile web browser. Mobile web applications are developed in such a way keeping in mind less payload delivery per each request. These applications are typically a scale down version of actual website which you can browse over any desktop browser such as Internet Explorer, Chrome, Firefox and Opera.

Every action mobile web application makes a round trip to server.

The advantages of having mobile web application is that:

  • Server Driven – we have full control on the website. and we can customize it any time, so that user will get the latest look and feel.
  • Targeting multiple platforms & connectivity – most of the mobiles and smartphones have a browser.  One-third of humankind currently has access to the Internet through a mobile device. That makes it easy to deliver our applications in any platform.
  • It enables services to take advantage of mobile device capabilities such as clicking on a phone number to call it or add it to the device address book. It can provide location-sensitive content. Location technologies can enable location-sensitive information be provided to a user. This can reduce the steps required for the user to reach useful content, and so makes it accessible with the least amount of effort.
  • For users, they don’t have to download an application or any maintenance updates, but instead “call up” a URL via their mobile browser which instantly delivers the most up-to-date application to their device.
  • Cross platform compatibility.
  • low development cost.

and the disadvantage is the bandwidth limitations and the limitations of Mobile websites, which does not access your Phone’s components like your Address book, Camera, etc.

The Mobile Web refers access to the world wide web, i.e. the use of browser-based Internet services, from a handheld mobile device, such as a smartphone, a feature phone or a tablet computer, connected to a mobile network or other wireless network.

Traditionally, access to the Web has been via fixed-line services on large-screen laptops and desktop computers. The shift to mobile Web access has been accelerating with the rise since 2007 of larger multitouch smartphones, and of multitouch tablet computers since 2010.

Both platforms provide better Internet access and browser- or application-based user Web experiences than previous generations of mobile devices have done.

Mobile Web access today still suffers from interoperability and usability problems. Interoperability issues stem from the platform fragmentation of mobile devices, mobile operating systems, and browsers. Usability problems are centered around the small physical size of the mobile phone form factors (limits on display resolution and user input/operating). 

[Wikipedia]

3. Hybrid Mobile Applications

Hybrid Mobile Applications are Applications that use BOTH browser interfaces and native mobile components. With HTML5 and JavaScripts, now the browsers are becoming capable of accessing a phone’s built in features like contacts, camera etc.

There are mobile frameworks based on HTML5 and JavaScript’s that would be able to access the device features such as Accelerometer, Compass, Contacts, Camera and device file system etc. Some popular such mobile frameworks are PhoneGap, Appcelerator’s Titanium etc. These frameworks helps in developing applications that would able to target most of the mobile platforms such as “iOS”, “Android”, “Windows Phone”, “Symbian” and “Blackberry”.

Appcelerator Titanium is a platform for developing mobile, tablet and desktop applications using web technologies.

Key to successful Hybrid Apps:

  • Make the experience feel like a native application.
  • Take advantage of the enhanced features.
  • Don’t simply release a hybrid version of the mobile web site.
  • Optimize performance

 

Mobile world is growing and you can see lots of opportunities for innovation. If you are a fan of building mobile applications go ahead and develop something that is in your dreams and leave it over to the rest of the world to carry forward.

 

Resources for Developing mobile applications:

PhoneGap (was called by the name Apache Callback, but now Apache Cordova) is an open-source mobile development framework produced by Nitobi, purchased by Adobe Systems. It enables software programmers to build applications for mobile devices using JavaScript, HTML5 and CSS3, instead of lower-level languages such as Objective-C. The resulting applications are hybrid, meaning that they are neither truly native (all layout rendering is done via the webview instead of the platform’s native UI framework) nor purely web based (they are not just web apps but packed for appstore distribution, and have access to part of the device application programming interface).

http://phonegap.com/ 

 

Appcelerator Titanium is a platform for developing mobile, tablet and desktop applications using web technologies. Appcelerator Titanium is developed by Appcelerator Inc.

Appcelerator Titanium Mobile is one of several phone web based application framework solutions allowing web developers to apply existing skills to create native applications for iPhone and Android. Yet, while using the familiar JavaScript syntax, developers will also have to learn the Titanium API, which is quite different from familiar web frameworks such as jQuery.

http://www.appcelerator.com/ 

 

Android Application Development: http://developer.android.com/index.html

Apple iOS Application Development: https://developer.apple.com/

Windows Phone Development: http://create.msdn.com/en-US/

http://msdn.microsoft.com/en-us/library/ff402535(v=vs.92).aspx

Blackberry Application Development:  https://bdsc.webapps.blackberry.com/devzone/

Bada Development: http://developer.bada.com

Symbian Development: http://www.developer.nokia.com/Devices/Symbian/

HP WebOS Development: https://developer.palm.com/

 

jQuery Mobile: Touch-Optimized Web Framework for Smartphones & Tablets

http://jquerymobile.com/ 

Sencha Touch: Sencha Touch was the first HTML5 mobile JavaScript framework for web applications that feel native on Android, BlackBerry, and iOS.
http://www.sencha.com/products/touch 

and more…

and some interesting learning resources

http://baymard.com/blog/responsive-web-design

Introducing KendoUI Mobile from Telerik (HTML5 Mobile Tools/Widgets for Development)

January 29, 2012 .NET, All, ANDROID, ASP.NET, iOS, iPhone, Microsoft, mobile web, Mobile-Development, VisualStudio, VS2010 No comments

KendoUI Mobile is a set of Reusable HTML5/Javascript widgets or tools for Mobile Web Application development. KendoUI is made available for Commercial(PAID) and Open use on Certain licensing conditions from Telerik.

KendoUI Logo  (Logo Courtesy: KendoUI.com)

KendoUI is a suite of new HTML5 Controls from Telerik. Telerik is a pioneer in .NET based reusable controls and other project management tools. Telerik provides readily available reusable components for different technologies such as Telerik .NET UI Controls for Silverlight, ASP.NET, ASP.NET MVC, ASP.NET AJAX, WinForms, WPF, Windows Phone etc . KendoUI is a new introduction by Telerik targetting HTML5 application development.

KendoUI Suite Consists of 3 packages

1. KendoUI Web – for building HTML5 based desktop web applications

2. KendoUI Mobile – for building HTML5 based mobile web applications

3. KendoUI DataWiz – for building HTML5 based data visualization applications.

Kendo UI combines everything needed for modern JavaScript development, including a powerful DataSource, universal Drag-and-Drop, Templates, Themes, and UI Widgets.

http://www.kendoui.com

What is special about KendoUI Mobile?

There are different other HTML5 based mobile application frameworks in the market, such as jQueryMobile, PhoneGap, Titanium, Sencha Touch.

jQuery Mobile: is a jQuery based HTML5 mobile web application framework and it provides consistent look and feel in all the supported platforms.

PhoneGap: which helps us to build Hybrid mobile applications (Half Native, Half Hybrid) using HTML5 and Javascript.

Sencha Touch: based on ExtJS (a popular javascript library, similar to jQuery), helps us in building HTML5 based mobile web applications provides native friendly appearance in target devices.

Titanium: Similar to PhoneGap but the end outcome would be native applications. Development will be done using HTML5 and JavaScript. End result will be a native application, underlying framework will convert javascript and HTML5 based syntax in to Native programming language and builds the output.

 

KendoUI Mobile? new addition to the mobile Web bandwagon using HTML5. As per Telerik, KendoUI Mobile provides native friendly look and feel on iOS and Android platforms( Unfortunately Version 1.0 of KendoUI Mobile will only target iOS and Android based appearance).

Taken from Kendo UI Website

  • Native UI widgets for building HTML5-powered apps and sites for modern mobile devices.
  • Making your mobile user interface touch responsive and with native look and feel.
Native UI on Every Device

Kendo UI Mobile helps developers build apps and sites for mobile devices that always look native. On iOS, Kendo UI Mobile widgets look native to iOS. On Android, Kendo UI Mobile widgets look native to Android. Automatically. Kendo UI Mobile detects the device and applies the proper styling.

Ready for App Stores

Easily build native-looking apps with Kendo UI Mobile and then deploy them through popular mobile app stores using packaging tools like PhoneGap. Get all of the benefits of native apps without any of the pain of writing the same app multiple times.

iOS, Android, and Beyond

In the first version, Kendo UI Mobile will provide UI widgets that match the theming and functionality of native controls available for iOS, Android and BlackBerry development, including buttons, navigation, and lists. With Kendo UI’s flexible styling system, developers can further customize Kendo UI Mobile themes easily to match any environment.

Personally I haven’t try anything using KendoUI or done a comparison amongst other Mobile Web Development platforms out there. Thus I will not give my take on the comparison of features etc. My idea about this post would be making you familiar about new offering from telerik – the Kendo UI.

KendoUI Mobile is recently released as Version 1.0 Beta, which provides Early Adopters to take a look at the new offering from telerik.

KendoUI is going to be a new interesting pet for all Telerik product adopters and developers. Hope to see more offerings from Telerik soon. Hope future Versions of KendoUI Mobile will have more platform support such as Blackberry, Bada, Windows Phone, Symbian etc. It is a relatively new product, way to go before it reaches it’s real momentum. But a very good offering from telerik.

 

Know more about Kendo UI visit http://www.kendoui.com/mobile

and also have a look at the nice demo put up by Kendo UI.  http://demos.kendoui.com/mobile/overview/index.html 

http://demos.kendoui.com/dataviz/overview/index.html 

http://demos.kendoui.com/web/overview/index.html 

 

Ref & Courtesy: Telerik, KendoUI Website