Presentation is loading. Please wait.

Presentation is loading. Please wait.

MOBILE DEVELOPMENT CHRIS FRANZ SYSTEMS CONSULTANT / ADVANTAGE EVANGELIST MAY 2011.

Similar presentations


Presentation on theme: "MOBILE DEVELOPMENT CHRIS FRANZ SYSTEMS CONSULTANT / ADVANTAGE EVANGELIST MAY 2011."— Presentation transcript:

1 MOBILE DEVELOPMENT CHRIS FRANZ SYSTEMS CONSULTANT / ADVANTAGE EVANGELIST MAY 2011

2 2 – European Advantage Conference – May 2011 AGENDA Introduction iOS Android Windows 7 Phone

3 3 – European Advantage Conference – May 2011 INTRODUCTION Picking a platform & development environment – Market share – Devices (features, cost) – Development community User groups Packages or libraries available – Cost of development Developer license

4 4 – European Advantage Conference – May 2011 PLATFORMS

5 5 – European Advantage Conference – May 2011 IPOD TOUCH IPHONE IPAD

6 6 – European Advantage Conference – May 2011 OVERVIEW Supported Devices – iPod Touch – iPhone – iPad Development Tools – xCode v3.2 and Interface Builder or xCode v4 – Objective-c – Emulators for iPhone and iPad Recommended Reading: Head First iPhone Development by Dan & Tracey Pilone

7 7 – European Advantage Conference – May 2011 APPLICATION ARCHITECTURE Follows MVC Model Application Components – Views – Frameworks – Resources

8 8 – European Advantage Conference – May 2011 ODATA OBJECTIVE-C CLIENT Available from Codeplex Consists of Two Components – MSODataLib – oDataGen Using With Your Project – Add location of MSODataLib source to project Header Path – Add location of libMSODataLib.a to project Library Path – Add libMSODataLib.a to project Frameworks

9 9 – European Advantage Conference – May 2011 GENERATING DATA CLASSES oDataGen creates data classes based on the metadata provided by the Advantage Web API Syntax odatagen /uri= [/out= ] [auth=windows|acs /u=username /p=password [/sn=servicenamespace [/at=appliesto] ] [/ups=yes|no] ] Example odatagen /uri=https://localhost:6282/adsweb/example_db/1/ /out=/Users/chrisfranz/projects/tasksapp /u=adssys

10 10 – European Advantage Conference – May 2011 EXAMPLE CLASS /** tasks_Model_Entities_Tasks : ODataObject { /** * NotNullable */ NSNumber *m_id; /** * NotNullable */ NSDecimalNumber *m_rowversion; /** */ NSString *m_name; /** */ NSDate *m_started; /** */ NSDate *m_finished; }

11 11 – European Advantage Conference – May 2011 EXAMPLE ( nonatomic, retain, getter=getid, setter=setid )NSNumber ( nonatomic, retain, getter=getrowversion, setter=setrowversion )NSDecimalNumber ( nonatomic, retain, getter=getname, setter=setname ) NSString ( nonatomic, retain, getter=getstarted, setter=setstarted )NSDate ( nonatomic, retain, getter=getfinished, setter=setfinished )NSDate *m_finished; + (id) CreateTasksWithid:(NSNumber *)aid rowversion:(NSDecimalNumber *)arowversion; - (id) init; - (id) + (id) CreateTasksWithid:(NSNumber *)aid rowversion:(NSDecimalNumber *)arowversion; - (id) init; - (id)

12 12 – European Advantage Conference – May 2011 INITWITHURI METHOD - (id) initWithUri:(NSString*)anUri { if(self=[super initWithUri:anUri]) { [self setBaseURI:anUri]; m_OData_hasStream.booleanvalue=NO; mProperties *obj; obj=[[mProperties FixedLength:NO Nullable:NO Unicode:NO FC_KeepInContent:YES [m_OData_propertiesMap setObject:obj [obj release]; obj=[[mProperties FixedLength:NO Nullable:NO Unicode:NO FC_KeepInContent:YES [m_OData_propertiesMap setObject:obj [obj release]; obj=[[mProperties FixedLength:YES Nullable:NO Unicode:YES FC_KeepInContent:YES [m_OData_propertiesMap setObject:obj [obj release]; obj=[[mProperties FixedLength:NO Nullable:NO Unicode:NO FC_KeepInContent:YES [m_OData_propertiesMap setObject:obj [obj release]; obj=[[mProperties FixedLength:NO Nullable:NO Unicode:NO FC_KeepInContent:YES [m_OData_propertiesMap setObject:obj [obj release]; NSMutableArray *anEntityKey=[[NSMutableArray alloc]init]; [anEntityKey [m_OData_entityKey setObject:anEntityKey [anEntityKey release]; } return self; }

13 13 – European Advantage Conference – May 2011 ACCESSING ADS DATA // Get all tasks from our service tasksData *proxy = [[tasksData alloc] credential:nil];http://server:6272/adsweb/example_db/v1/ QueryOperationResponse *response = [proxy _tasksArray = [response getResult]; [_tasksArray retain]; %d tasks back", [_tasksArray count] ); // Log contents of first row as an example Tasks *task = [_tasksArray objectAtIndex:1]; TaskName: StartDate: [task getname], [task getstarted] ? [[task getstarted] description] Yet" );

14 14 – European Advantage Conference – May 2011 ANDROID

15 15 – European Advantage Conference – May 2011 OVERVIEW Android OS - – Android is an open source mobile platform – Developed by the Open Handset Alliance – Strongly driven by Google – Supports multiple devices and carriers Development – – Built on Linux micro kernel – Applications written in Java – SDK and emulator are free – Eclipse IDE with plug-in is used for development

16 16 – European Advantage Conference – May 2011 APPLICATION OVERVIEW Architecture – Applications do not exit – UI can be paused, resumed, or terminated by system at anytime – A single thread handles all UI for entire device No blocking or long calls in UI thead Building Blocks – Activities – Service and Content Providers – Intents and Broadcast Receivers

17 17 – European Advantage Conference – May 2011 DESIGN PATTERNS FOR DATA ACCESS Three suggested design patterns – Content Provider API – Content Provider API with SyncAdapter – Service API Video from Google IO 10 covers all three patterns – g-RESTful-android-apps.html g-RESTful-android-apps.html

18 18 – European Advantage Conference – May 2011 CONTENT PROVIDER API PATTERN Activity and CursorAdapter Content Provider Asynchronous Service oData Client Processor 1. query, insert, update, delete 7. notification 2. startService(intent)5. returned data 3. oData request 4. GET/POST/ PUT/DELETE 6. update\insert 8. requery

19 19 – European Advantage Conference – May 2011 CONTENT PROVIDER API PATTERN Activity and Cursor Adapter – Displays data – Use ContentObservers to receive notifications of data changes – Should re-query data when notified – Android CursorAdaptors and ListViews handle notifications automatically Content Provider – Caches data in local SQLite database – Requests oData call from Asynchronous Service – Returns local cached data – Sends notifications when data changes

20 20 – European Advantage Conference – May 2011 CONTENT PROVIDER API PATTERN Asyncronous Service – Sets up oData request – Checks for existing oData request – Registers the Processor callback with the thread – Starts new thread to perform oData request – Handles callback even if requesting Activity is terminated Processor – Callback used to process results from oData query – Uses the Content Provider to update local SQLite database Causes Content Provider to notify observers

21 21 – European Advantage Conference – May 2011 ODATA CLIENT Two existing oData clients for Android – Restlet – oData4j Both clients work with Advantage and are actively being developed Provide slightly different licenses

22 22 – European Advantage Conference – May 2011 EXAMPLE import org.restlet.ext.odata.Query; import com.advantage.example.android.quick.task.tasks.model.entities.Tasks; public class Main extends Activity { private static final String TAG = Main.class.getSimpleName(); /** Called when the activity is first created. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TasksModelService model = new TasksModelService();; Query query = model.createTasksQuery("/Tasks"); try { query.execute(); } catch (Exception e) { e.printStackTrace(); } for ( Tasks task : query) { Log.i(TAG, task.getName()); }

23 23 – European Advantage Conference – May 2011 WINDOWS PHONE 7

24 24 – European Advantage Conference – May 2011 WINDOWS 7 PHONE Tools – Visual Studio 2010 (express is free, even for commercial use) – Windows Phone 7 Developer Tools (work in progress) – Phone emulator works very well

25 25 – European Advantage Conference – May 2011 CONNECTING TO ADS oData Proxy Class or Object - Add Service Reference dialog

26 26 – European Advantage Conference – May 2011 ACCESSING ADS DATA Use the proxy class (object) to access tables Uri serviceUri = new Uri( ); Context = new testddData( serviceUri ); IEnumerable query; query = from c in context.Customers select c; IList cList = query.ToList(); foreach ( Customers c in cList ) Console.WriteLine( "{0,4} {1,10} {2,10}", c.ID, c.Name, c.Location );

27 27 – European Advantage Conference – May 2011 SILVERLIGHT private void Window_Loaded( object sender, RoutedEventArgs e ) { var context = new testdd.testddData( new Uri( )); var query = from c in context.Customers select c; DataContext = query.ToList(); }

28 28 – European Advantage Conference – May 2011 MORE Example videos on MSDN –

29


Download ppt "MOBILE DEVELOPMENT CHRIS FRANZ SYSTEMS CONSULTANT / ADVANTAGE EVANGELIST MAY 2011."

Similar presentations


Ads by Google