TechWeekend Pune 7, on Mobile Application Development was held on Saturday, 19th Feb. These are the live-tweets, collected here for your benefit. Remember, they are live-tweets that were being typed while the event was happening, so they’re not necessarily as coherent and as well-organized as a regular article.
Windows Phone 7 by Mayur Tendulkar
The first talk was by Mayur Tendulkar talking about Windows Phone 7
- This talk is a basic overview of Windows Phone 7. Important now, because Nokia has now thrown its weight behind it.
- “If windows is not behaving well, you format your drive and start again. MSFT did same with its Mobile OS. Win Phone 7 is completely new”
- Mobile phone world suffers from large number of devices of different resolutions that behave differently. This is not true of Win Mobile 7. Windows Phone 7 insists on a standardized hardware & screen configuration. So your Win Phone 7 will always look and behave the same.
- WinPhone7 screen config: 480×800 or 320×480. No other sizes allowed. S-LCD/AMOLED capacitive touchscreen. 4-point multi-touch
- WinPhone7 will always have these sensors: A-GPS, proximity sensor, accelerometer, compass, light.
- All WinPhone7 devices must have these three buttons: Start, Back, Search. (As usual, to shutdown, you press Start 🙂
- App Development for WinPhone7: regular apps using Silverlight, and game apps using XNA.
- “Silverlight is just like Flash”. Modern app UI framework. Apparently has 500,000 developers spanning windows, web (and now mobile)
- Visit the Tata Nano site or the Hard Rock Cafe New York site to see some cool uses of Silverlight
- The XNA framework for game development is mature and widely accepted – because it was in XBox 360, Windows and Zune.
- WinPhone7 developers get all the goodness of Visual Studio for developing mobile apps with Visual Studio 2010 Express for WP.
- Other developer tools: Silverlight Dev Kit. XNA Game Studio 4.0. Expression Blend 4.0. Also VB for WinPhone7.
- All these development tools for WinPhone7 are free.
This was followed by a walk through of building a WinPhone7 app using Visual Studio 2010 and Silverlight.
Some interesting audience Q&A:
- Q: What languages are supported for WinPhone7 development? A: At this point, only Visual Basic and C#
- Q: Does WinPhone7 support multi-tasking. A: No. Some standard system services can run in the background; but apps don’t multitask.
Cross-Platform Mobile Application Development by Rohit Ghatol
Next up: Rohit Ghatol talking about cross-platform mobile app development using phonegap, titanium etc.
- Two ways of developing cross-platform apps. 1. Develop html5 apps for webkit. 2. Use a translator that translates your app to native code.
- For now, all major mobile platforms have a webkit based browser (except WinPhone7). So writing an app targeting webkit is “cross-platform”
- Q: Will a webkit based app work with WinPhone7? A: No. But Mango release of WinPhone7 will support html5, so you should be close.
- Note: HTML5/CSS3 development for mobile apps works because all phone browsers are much more advanced on this issue than desktop browsers
- Features supported by phonegap: accelerometer, camera, compass, contacts, file io, geolocation, audio recording, sound, vibration, storage. Note: not all these features are supported on all mobile phone platforms
- So with PhoneGap app development, you’ll probably be doing UIs by using JQueryUI or something like that.
- Note: PhoneGap ultimately creates a native app that users install. Not just a website that they visit in the browser.
- At this point, Rohit, showed actual PhoneGap code for a mobile app – to write an app that shows a google map of my current location.
- Big challenge of PhoneGap is that you need to bring your own UI development framework. This is an advantage also! – PhoneGap allows you to have same UI framework for website as well as your mobile app.
- Rohit’s suggestions for UI framework – 1. GWT 2. jQueryMobile
- You have two different directories for images – one for Android, & one for iPhone, because they handle images differently.
- iPhone requires just one size of images. Android allows different images for different screen sizes/resolutions/orientations.
- Titanium problem – layout is absolute. For people used to the great layout capabilities of Android, this is a big step down
- Titanium uses native UI (iPhone and Android), where are PhoneGap uses non-native (html/css) UI. Former gives better experience…
- Building your own webkit based cross-platform framework makes sense if you want to overcome limitations of phonegap/titanium.
- This won’t be as clean as phonegap/titanium, but might be good for your specific case. Steal phonegap/titanium code if required!
- Comparison of PhoneGap vs Titanium. Titanium more proprietary, limited UI, …
Android Performance Tuning by Anand Hariharan
Next speaker was Anand Hariharan talking about Android Performance tuning.
- For app performance: first focus on what the user wants, don’t just improve performance for the sake of improving performance. Optimize only after measuring performance, and having specific performance goals. A lot of performance tuning, is really about managing user perception. When doing something that will take time, keep user engaged.
- Don’t optimize everything for performance – you don’t have the time. Focus on the most important user visible features and fix those. In mobile world – reduce features and use the time saved on fixing performance.
- Manage user perception better: e.g. Apple’s use of loading a bitmap image of app at beginning to give impression that app has loaded. At app startup time, load a bitmap that looks like your app without the latest data. Gives impression that app load is fast.
- Performance tips: All platforms have a “recommended best practices” doc. Read that – many developers dont 🙂 e.g. Android best practice: for tasks that take time, use a background service (not an activity).
- Anand talking about how to avoid an “Application Not Responding” (ANR) dialog for your app
- An android app is single-threaded. So don’t do io (network or disk) synchronously. Use an async mechanism.
- Keep activities small. Don’t overload activities. Use different activities to do different things.
- Use the minimum number of views. Do not use a deeply nested view hierarchy. Your view hierarchy shouldn’t be more than 3 levels deep. If you’re views are getting complicated, consider writing custom views.
- Track memory allocations. Garbage collection happening during user activity causes slowdowns.
- Close your cursors. Otherwise garbage collector cannot reclaim memory. Then you get GC cycles, and slowdowns.
- use onRetainNonConfigurationInstance() to retain large amounts of data between device orientation changes (landscape to portrait)
- Use SoftReferences to cache data so that the garbage collector can reclaim the memory when required.
- Avoid database writes as far as possible. Writes take 5ms to 200ms. And full SD card has slower writes.
- Avoid using data from mutiple tables in a single list (AdapterView). First copy data from multiple tables to a single table and show that. e.g. in Email app, subject and body came from different tables. This really slowed down the inbox view (which shows first line of body).
- Tools to help with android app optimization: Fix your views using: hierarchyviewer, layoutopt. Check flow & times using: traceview. Use zipalign to optimize your apk (improves app load time).
- Above all, you must understand what you’re optimizing and why. Measure, measure, measure.