SlideShare uma empresa Scribd logo
1 de 48
Android 101Introduksjon til Android Truls Jørgensenog Are Wold 8. september 2010
Truls Are
Bidragsyterefra Android fokusgruppe Hans Petter Eide Knut BjørnarWålberg © 2010 Capgemini. All rights reserved. 3
Agenda © 2010 Capgemini. All rights reserved.
Bakgrunn Android kjøpesoppav Google i 2005  Googlesmotivasjon "Bedretjenesterogbrukeropplevelsepåmobilgirmermobilnettbrukogmerpengerireklamekassatil Google" (Computerworld UK) "Merinnovasjonpå mobile plattformer", "The world was broken"-  Rich Miner, Google  Sidekick T-Mobile G1 / HTC Dream Nexus One © 2010 Capgemini. All rights reserved.
Android! "The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation" - Andy Rubin, Google  © 2010 Capgemini. All rights reserved.
© 2010 Capgemini. All rights reserved.
! Android… © 2010 Capgemini. All rights reserved.
Business case - markedsandeler 13% 13% 3% 17% © 2010 Capgemini. All rights reserved.
Utviklingsverktøy og dokumentasjon Tilgjengeligeutviklingsplattformer Eclipse, SDK Emulator, ADB, SQLite Debugging på device Dalvik debug monitor - tilstandpåenheten LogCat Online API reference, Java style http://developer.android.com © 2010 Capgemini. All rights reserved.
..and now for somethingcompletelydifferent!
JZinema BETA! (butreleasingon time) © 2010 Capgemini. All rights reserved.
Byggeklosser  i Android © 2010 Capgemini. All rights reserved.
Byggeklosser  i Android © 2010 Capgemini. All rights reserved.
Intent Intent Activities og intents © 2010 Capgemini. All rights reserved. Intent MovieListActivity MovieDetailActivity (eksterne Activities)
Skjermbilder © 2010 Capgemini. All rights reserved.
Fra XML til Java © 2010 Capgemini. All rights reserved. // res/layout/movie_list.xml <Button android:id="@+id/select_city_button“  android:textSize="20dp” /> // R.java  public static final class id {      (…)      public static final intselect_city_button=0x7f070016;  } // MovieListActivity.java  mCinemaButton = (Button) findViewById(R.id.select_city_button);
MovieList.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF"  	  (…) 	 	  <Button android:id="@+id/movie_list_cinema"  android:textSize="20dp" android:background="@drawable/select_city_button" android:text=“@string/select_city_text“ /> </LinearLayout> Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved. res/values/string.xml: (…) <stringname=”select_city_text">Velgby</string>
Activity – MovieListActivity.java publicclassMovieListActivityextendsListActivity { 	(…) /** Called when the activity is first created. */ @Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movie_list); mMovieListHeader = (TextView) findViewById(R.id.movie_list_header); currentCity = getSelectedCity(); mMovieListHeader.setText( getString(R.string.header_text_now_showing_in) + currentCity); updateMoviesForCity(currentCity); 	   (…) 	} } Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
Byggeklosser  i Android © 2010 Capgemini. All rights reserved.
Kommunikasjonmellomkomponenter ,[object Object]
Starte en Activity – spesifisert, eller ikke
Sende en melding til systemet
Starte eller koble på en Service© 2010 Capgemini. All rights reserved.
Intents mellom activites © 2010 Capgemini. All rights reserved. // MovieListActivity.java final Intent intent = new Intent(this, MovieDetails.class); intent.putExtra(MoviesProvider._ID, id); startActivity(intent); // MovieDetailsActivity.java finalIntentintent = getIntent(); long id = intent.getExtras().getLong(MoviesProvider._ID); Insert "Title, Author, Date"
Intents mellom applikasjoner © 2010 Capgemini. All rights reserved. // MovieDetailsActivity.java final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(buyTicketLink)); startActivity(intent); // MovieDetailsActivity.java final Intent intent= new Intent(Intent.ACTION_VIEW); intent.setDataAndType(   	Uri.parse(mMovieDetailsTrailerUrl),"video/*"); startActivity(intent);
Byggeklosser  i Android © 2010 Capgemini. All rights reserved.
Content Provider Wrapper rundt en datakilde For data somønskestilbudttilandreapplikasjoner (egentlig)  Standardiserttilgangtil data vha CONTENT_URI: content://no.jzinema.provider.Movies/movies © 2010 Capgemini. All rights reserved.
Content Provider: Persistering © 2010 Capgemini. All rights reserved. Content Provider Sqlite DB // Lagre en film // CONTENT_URI: content://no.jzinema.provider.Movies/movies Uriuri = mContext.getContentResolver(). insert(MoviesProvider.CONTENT_URI, values);
Content Provider: Henting av data © 2010 Capgemini. All rights reserved. Content Provider Sqlite DB // MovieDetailsActiviy.java henter en film: //content://no.jzinema.provider.Movies/movies/5 Cursor c =  managedQuery(ContentUris.withAppendedId( MoviesProvider.CONTENT_URI, _id),          null, null, null, null); // MovieListActivity.java spør  // (blant annet) etter alle filmers id Cursor c = managedQuery(MoviesProvider.CONTENT_URI, COLUMN_ID, null, null, null);
MoviesContentProvider.java publicclassMoviesProviderextendsContentProvider { 	publicstaticfinal String AUTHORITY = "no.jzinema.provider.Movies"; publicstaticfinal Uri CONTENT_URI =  Uri.parse("content://" + AUTHORITY + "/movies"); @Override publicbooleanonCreate(…) @Override public Uri insert(…)  @Override 	public Cursor query(…) @Override 	publicint update(…) @Override 	publicint delete(…)  @Override 	public String getType(…) } Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
MovieListActivity: Cursor og CursorAdapter © 2010 Capgemini. All rights reserved. // Alle filmer i en by Cursor cursor = getContentResolver().query(   MoviesProvider.CONTENT_URI, COLUMNS, MovieConstants.ATTRIBUTE_ID + " IN (" + movieIds + ")", null, null); startManagingCursor(cursor); // Opprett et cursorAdaptersombenyttercursorentil å populerehverradi listen  mAdapter = newMovieListCursorAdapter (this, R.layout.movie_list_row, cursor, COLUMNS, VIEWS_IN_LIST_ROW); // ListActivitytrenger et adapter. this.setListAdapter(mAdapter); Content Provider Sqlite DB
DEMO: Live debugging Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
Byggeklosser  i Android © 2010 Capgemini. All rights reserved.
Konfigurering AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="no.capgemini.jzinema” android:versionCode="1” android:versionName="1.0"> <!-- Permissions --> <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@drawable/icon" android:label="@string/app_name" 	android:debuggable="true"> 		<!-- Activity for showing a list of movies currently running in the cinemas--> 		<activity android:name=".MovieList“> 	         <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="no.capgemini.jzinema.SHOW_MOVIELIST" /> </intent-filter> </activity> <providerandroid:authorities="no.jzinema.provider.Movies“ android:name=".provider.MoviesProvider“ /> 	</application> <uses-sdkandroid:minSdkVersion=“4" /> </manifest> © 2010 Capgemini. All rights reserved.
AndroidManifest.xml  - utdrag <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="no.capgemini.jzinema” android:versionCode="1” android:versionName="1.0"> <!-- Permissions --> <uses-permission android:name="android.permission.INTERNET" /> 	 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <!-- Activity for showing a list of movies currently running in the cinemas. --> <activity android:name=".activity.movielist.MovieListActivity" android:label="@string/app_name" android:configChanges="orientation"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <providerandroid:authorities="no.jzinema.provider.Movies“ android:name=".provider.MoviesProvider“ /> 	</application> <uses-sdkandroid:minSdkVersion=“4" /> </manifest> Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
Strukturen i en Android-app ligner på en webapp © 2010 Capgemini. All rights reserved.
Testing på Android © 2010 Capgemini. All rights reserved.
DEMO Robotium Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
Andre byggeklosser  i Android © 2010 Capgemini. All rights reserved.
En mobil har sine begrensninger Strøm Datatrafikk Begrenset hardware Cursors, liksom? Komplekse livssykluser Multitasking © 2010 Capgemini. All rights reserved.
Aktivitet starter Forenkletlivssyklus for en Activity onCreate() Bruker går tilbake til aktiviteten onStart() onRestart() onResume() Prosess drept Aktivitet kjører Aktivitet havner i forgrunnen Aktivitet havner i bakgrunnen Aktivitet havner i forgrunnen onSaveInstanceState() onPause() Lavt minne Aktiviteten er usynlig onStop() Aktivitet avsluttet Lavt minne, finish() onDestroy() © 2010 Capgemini. All rights reserved.
Ytelse foran alt ,[object Object]
Hissig GarbageCollection
Du veit aldri når’em kommer
Nettverk kan være tregt og dyrt
Tenk lokal caching
Trådhåndtering:

Mais conteúdo relacionado

Semelhante a Android101 : Introduksjon til Android

Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Loïc Knuchel
 
PhoneGap, Backbone & Javascript
PhoneGap, Backbone & JavascriptPhoneGap, Backbone & Javascript
PhoneGap, Backbone & Javascriptnatematias
 
Automated testing of mobile applications on multiple platforms
Automated testing of mobile applications on multiple platformsAutomated testing of mobile applications on multiple platforms
Automated testing of mobile applications on multiple platformsjobandesther
 
ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013Mathias Seguy
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013Junda Ong
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumAxway Appcelerator
 
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAAppcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAJeff Haynie
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Alina Vilk
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersJiaxuan Lin
 
Opticon 2015 - Getting Started with the Optimizely Developer Platform
Opticon 2015 - Getting Started with the Optimizely Developer PlatformOpticon 2015 - Getting Started with the Optimizely Developer Platform
Opticon 2015 - Getting Started with the Optimizely Developer PlatformOptimizely
 
UberFire Quick Intro and Overview (early beta Aug 2013)
UberFire Quick Intro and Overview (early beta Aug 2013)UberFire Quick Intro and Overview (early beta Aug 2013)
UberFire Quick Intro and Overview (early beta Aug 2013)Mark Proctor
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Filippo Matteo Riggio
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)Kenji Sakashita
 
Android is not just mobile
Android is not just mobileAndroid is not just mobile
Android is not just mobileKevin McDonagh
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEBenjamin Cabé
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011sullis
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...Matt Raible
 

Semelhante a Android101 : Introduksjon til Android (20)

Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
 
PhoneGap, Backbone & Javascript
PhoneGap, Backbone & JavascriptPhoneGap, Backbone & Javascript
PhoneGap, Backbone & Javascript
 
Automated testing of mobile applications on multiple platforms
Automated testing of mobile applications on multiple platformsAutomated testing of mobile applications on multiple platforms
Automated testing of mobile applications on multiple platforms
 
ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
 
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CAAppcelerator iPhone/iPad Dev Con 2010 San Diego, CA
Appcelerator iPhone/iPad Dev Con 2010 San Diego, CA
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
 
Opticon 2015 - Getting Started with the Optimizely Developer Platform
Opticon 2015 - Getting Started with the Optimizely Developer PlatformOpticon 2015 - Getting Started with the Optimizely Developer Platform
Opticon 2015 - Getting Started with the Optimizely Developer Platform
 
UberFire Quick Intro and Overview (early beta Aug 2013)
UberFire Quick Intro and Overview (early beta Aug 2013)UberFire Quick Intro and Overview (early beta Aug 2013)
UberFire Quick Intro and Overview (early beta Aug 2013)
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)
 
Android is not just mobile
Android is not just mobileAndroid is not just mobile
Android is not just mobile
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Top Tips for Android UIs
Top Tips for Android UIsTop Tips for Android UIs
Top Tips for Android UIs
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
 
Android TCJUG
Android TCJUGAndroid TCJUG
Android TCJUG
 

Mais de Truls Jørgensen

Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdf
Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdfOptimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdf
Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdfTruls Jørgensen
 
Open source all the offentlig things
Open source all the offentlig thingsOpen source all the offentlig things
Open source all the offentlig thingsTruls Jørgensen
 
From 4 releases a year to once every other minute
From 4 releases a year to once every other minuteFrom 4 releases a year to once every other minute
From 4 releases a year to once every other minuteTruls Jørgensen
 
Alignment in the age of autonomy
Alignment in the age of autonomyAlignment in the age of autonomy
Alignment in the age of autonomyTruls Jørgensen
 
The systems behind the best welfare state in the world
The systems behind the best welfare state in the worldThe systems behind the best welfare state in the world
The systems behind the best welfare state in the worldTruls Jørgensen
 
Systemene bak verdens beste velferdsstat
Systemene bak verdens beste velferdsstatSystemene bak verdens beste velferdsstat
Systemene bak verdens beste velferdsstatTruls Jørgensen
 

Mais de Truls Jørgensen (9)

Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdf
Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdfOptimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdf
Optimising for Fast Flow in Norway's Largest Bureaucracy04042022.pdf
 
Smidig i coronakrise
Smidig i coronakriseSmidig i coronakrise
Smidig i coronakrise
 
Continuous monitoring
Continuous monitoringContinuous monitoring
Continuous monitoring
 
Open source all the offentlig things
Open source all the offentlig thingsOpen source all the offentlig things
Open source all the offentlig things
 
Software er politikk
Software er politikkSoftware er politikk
Software er politikk
 
From 4 releases a year to once every other minute
From 4 releases a year to once every other minuteFrom 4 releases a year to once every other minute
From 4 releases a year to once every other minute
 
Alignment in the age of autonomy
Alignment in the age of autonomyAlignment in the age of autonomy
Alignment in the age of autonomy
 
The systems behind the best welfare state in the world
The systems behind the best welfare state in the worldThe systems behind the best welfare state in the world
The systems behind the best welfare state in the world
 
Systemene bak verdens beste velferdsstat
Systemene bak verdens beste velferdsstatSystemene bak verdens beste velferdsstat
Systemene bak verdens beste velferdsstat
 

Último

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Android101 : Introduksjon til Android

  • 1. Android 101Introduksjon til Android Truls Jørgensenog Are Wold 8. september 2010
  • 3. Bidragsyterefra Android fokusgruppe Hans Petter Eide Knut BjørnarWålberg © 2010 Capgemini. All rights reserved. 3
  • 4. Agenda © 2010 Capgemini. All rights reserved.
  • 5. Bakgrunn Android kjøpesoppav Google i 2005 Googlesmotivasjon "Bedretjenesterogbrukeropplevelsepåmobilgirmermobilnettbrukogmerpengerireklamekassatil Google" (Computerworld UK) "Merinnovasjonpå mobile plattformer", "The world was broken"-  Rich Miner, Google Sidekick T-Mobile G1 / HTC Dream Nexus One © 2010 Capgemini. All rights reserved.
  • 6. Android! "The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation" - Andy Rubin, Google  © 2010 Capgemini. All rights reserved.
  • 7. © 2010 Capgemini. All rights reserved.
  • 8. ! Android… © 2010 Capgemini. All rights reserved.
  • 9. Business case - markedsandeler 13% 13% 3% 17% © 2010 Capgemini. All rights reserved.
  • 10. Utviklingsverktøy og dokumentasjon Tilgjengeligeutviklingsplattformer Eclipse, SDK Emulator, ADB, SQLite Debugging på device Dalvik debug monitor - tilstandpåenheten LogCat Online API reference, Java style http://developer.android.com © 2010 Capgemini. All rights reserved.
  • 11. ..and now for somethingcompletelydifferent!
  • 12. JZinema BETA! (butreleasingon time) © 2010 Capgemini. All rights reserved.
  • 13. Byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 14. Byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 15. Intent Intent Activities og intents © 2010 Capgemini. All rights reserved. Intent MovieListActivity MovieDetailActivity (eksterne Activities)
  • 16. Skjermbilder © 2010 Capgemini. All rights reserved.
  • 17. Fra XML til Java © 2010 Capgemini. All rights reserved. // res/layout/movie_list.xml <Button android:id="@+id/select_city_button“ android:textSize="20dp” /> // R.java public static final class id { (…) public static final intselect_city_button=0x7f070016; } // MovieListActivity.java mCinemaButton = (Button) findViewById(R.id.select_city_button);
  • 18. MovieList.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF" (…) <Button android:id="@+id/movie_list_cinema" android:textSize="20dp" android:background="@drawable/select_city_button" android:text=“@string/select_city_text“ /> </LinearLayout> Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved. res/values/string.xml: (…) <stringname=”select_city_text">Velgby</string>
  • 19. Activity – MovieListActivity.java publicclassMovieListActivityextendsListActivity { (…) /** Called when the activity is first created. */ @Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movie_list); mMovieListHeader = (TextView) findViewById(R.id.movie_list_header); currentCity = getSelectedCity(); mMovieListHeader.setText( getString(R.string.header_text_now_showing_in) + currentCity); updateMoviesForCity(currentCity); (…) } } Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
  • 20. Byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 21.
  • 22. Starte en Activity – spesifisert, eller ikke
  • 23. Sende en melding til systemet
  • 24. Starte eller koble på en Service© 2010 Capgemini. All rights reserved.
  • 25. Intents mellom activites © 2010 Capgemini. All rights reserved. // MovieListActivity.java final Intent intent = new Intent(this, MovieDetails.class); intent.putExtra(MoviesProvider._ID, id); startActivity(intent); // MovieDetailsActivity.java finalIntentintent = getIntent(); long id = intent.getExtras().getLong(MoviesProvider._ID); Insert "Title, Author, Date"
  • 26. Intents mellom applikasjoner © 2010 Capgemini. All rights reserved. // MovieDetailsActivity.java final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(buyTicketLink)); startActivity(intent); // MovieDetailsActivity.java final Intent intent= new Intent(Intent.ACTION_VIEW); intent.setDataAndType( Uri.parse(mMovieDetailsTrailerUrl),"video/*"); startActivity(intent);
  • 27. Byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 28. Content Provider Wrapper rundt en datakilde For data somønskestilbudttilandreapplikasjoner (egentlig)  Standardiserttilgangtil data vha CONTENT_URI: content://no.jzinema.provider.Movies/movies © 2010 Capgemini. All rights reserved.
  • 29. Content Provider: Persistering © 2010 Capgemini. All rights reserved. Content Provider Sqlite DB // Lagre en film // CONTENT_URI: content://no.jzinema.provider.Movies/movies Uriuri = mContext.getContentResolver(). insert(MoviesProvider.CONTENT_URI, values);
  • 30. Content Provider: Henting av data © 2010 Capgemini. All rights reserved. Content Provider Sqlite DB // MovieDetailsActiviy.java henter en film: //content://no.jzinema.provider.Movies/movies/5 Cursor c = managedQuery(ContentUris.withAppendedId( MoviesProvider.CONTENT_URI, _id), null, null, null, null); // MovieListActivity.java spør // (blant annet) etter alle filmers id Cursor c = managedQuery(MoviesProvider.CONTENT_URI, COLUMN_ID, null, null, null);
  • 31. MoviesContentProvider.java publicclassMoviesProviderextendsContentProvider { publicstaticfinal String AUTHORITY = "no.jzinema.provider.Movies"; publicstaticfinal Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/movies"); @Override publicbooleanonCreate(…) @Override public Uri insert(…) @Override public Cursor query(…) @Override publicint update(…) @Override publicint delete(…) @Override public String getType(…) } Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
  • 32. MovieListActivity: Cursor og CursorAdapter © 2010 Capgemini. All rights reserved. // Alle filmer i en by Cursor cursor = getContentResolver().query( MoviesProvider.CONTENT_URI, COLUMNS, MovieConstants.ATTRIBUTE_ID + " IN (" + movieIds + ")", null, null); startManagingCursor(cursor); // Opprett et cursorAdaptersombenyttercursorentil å populerehverradi listen mAdapter = newMovieListCursorAdapter (this, R.layout.movie_list_row, cursor, COLUMNS, VIEWS_IN_LIST_ROW); // ListActivitytrenger et adapter. this.setListAdapter(mAdapter); Content Provider Sqlite DB
  • 33. DEMO: Live debugging Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
  • 34. Byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 35. Konfigurering AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="no.capgemini.jzinema” android:versionCode="1” android:versionName="1.0"> <!-- Permissions --> <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <!-- Activity for showing a list of movies currently running in the cinemas--> <activity android:name=".MovieList“> <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="no.capgemini.jzinema.SHOW_MOVIELIST" /> </intent-filter> </activity> <providerandroid:authorities="no.jzinema.provider.Movies“ android:name=".provider.MoviesProvider“ /> </application> <uses-sdkandroid:minSdkVersion=“4" /> </manifest> © 2010 Capgemini. All rights reserved.
  • 36. AndroidManifest.xml - utdrag <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="no.capgemini.jzinema” android:versionCode="1” android:versionName="1.0"> <!-- Permissions --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <!-- Activity for showing a list of movies currently running in the cinemas. --> <activity android:name=".activity.movielist.MovieListActivity" android:label="@string/app_name" android:configChanges="orientation"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <providerandroid:authorities="no.jzinema.provider.Movies“ android:name=".provider.MoviesProvider“ /> </application> <uses-sdkandroid:minSdkVersion=“4" /> </manifest> Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
  • 37. Strukturen i en Android-app ligner på en webapp © 2010 Capgemini. All rights reserved.
  • 38. Testing på Android © 2010 Capgemini. All rights reserved.
  • 39. DEMO Robotium Insert "Title, Author, Date" © 2010 Capgemini. All rights reserved.
  • 40. Andre byggeklosser i Android © 2010 Capgemini. All rights reserved.
  • 41. En mobil har sine begrensninger Strøm Datatrafikk Begrenset hardware Cursors, liksom? Komplekse livssykluser Multitasking © 2010 Capgemini. All rights reserved.
  • 42. Aktivitet starter Forenkletlivssyklus for en Activity onCreate() Bruker går tilbake til aktiviteten onStart() onRestart() onResume() Prosess drept Aktivitet kjører Aktivitet havner i forgrunnen Aktivitet havner i bakgrunnen Aktivitet havner i forgrunnen onSaveInstanceState() onPause() Lavt minne Aktiviteten er usynlig onStop() Aktivitet avsluttet Lavt minne, finish() onDestroy() © 2010 Capgemini. All rights reserved.
  • 43.
  • 45. Du veit aldri når’em kommer
  • 46. Nettverk kan være tregt og dyrt
  • 50. Tråder med en handler© 2010 Capgemini. All rights reserved.
  • 52. Fordeler Føles kjent Herlig hardware Debug på device Lett å komme i gang! Godt dokumentert Et moderne OS  GC Ryddige APIer Community Enkelt å publisere © 2010 Capgemini. All rights reserved.
  • 53. Ulemper Mange konfigurasjoner å sikte mot Hardware og OS-versjoner Android Market – ikke Bogstadveien ..og ikke betalte applikasjoner i Norge enda TREG emulator © 2010 Capgemini. All rights reserved.
  • 54. Konklusjon Morsomt Utfordrende begrensninger Vil du utvikle for mobiltelefoner er dette veien å gå! Mer mobilmoro: ”Scala på Androider” kl 14:15, Sal 6 Thor Åge Eldby ”Fra iPhone-idé til AppStore-publisering” Kl 13:30, sal 7 (lyntale) Markuz Lindgren © 2010 Capgemini. All rights reserved.
  • 55. © 2010 Capgemini. All rights reserved. SjekkutJZinema! Last ned frahttp://tinyurl.com/jzinema BETA! (butreleasingon time)
  • 56. Spørsmål? Vi står på Capgeminis stand de neste fire timene Mulighet for å leke med kildekoden på stand eller på http://code.google.com/p/jzinema/ Feeds ikke inkludert! © 2010 Capgemini. All rights reserved.
  • 58. Kilder Pro Android 2 GoogleAndroidphoneshipmentsincrease by 886% - http://www.bbc.co.uk/news/technology-10839034  Google'sAndroidstrategyexplained - http://www.computerworlduk.com/in-depth/mobile-wireless/890/analysis-googles-android-mobile-strategy-explained/  Rich Miner sitert på Internetnews: http://www.internetnews.com/mobility/article.php/12220_3780476_2 Bilder Kløverbilde: cygnus921@flickr Android med Androider: iwallenstein Android-bamse: laihiu@flickr Android YAY – maxbraun@flickr Android Mini Collectibles – droidzebra, Inc Googles første prodserver – jurvetson@flickr Zebra stripes: schnappi@flickr Raptor: XKCD # 135 Record needle: stevecadman@flickr Satellite dish, ryaninc@flickr EvolutionofAndroid: http://www.intomobile.com/2010/07/13/evolution-of-android-follow-the-gingerbread-roadmap/ Andy Rubin ved lanseringen av Android: http://googleblog.blogspot.com/2007/11/wheres-my-gphone.html Ytelse: http://developer.android.com/guide/practices/design/performance.html © 2010 Capgemini. All rights reserved.