Android 4.1/4.2
Upcoming SlideShare
Loading in...5
×
 

Android 4.1/4.2

on

  • 889 views

Speaker: Lars Röwekamp ...

Speaker: Lars Röwekamp
MobileTechCon
13.3.2013

Spätestens seit Android 4.0 ist klar, dass iOS einen nicht mehr wegzudiskutierenden Konkurrenten bekommen hat. Ein vereinheitlichtes Entwicklungsmodell für Smartphones und Tablets sowie UI Design Guidelines für eine optimale User Experience bringen Android endgültig auf die Erfolgsspur. Doch wie geht es weiter? Bereits Jelly Bean (4.1) zeigt, dass noch lange nicht das Ende erreicht ist. Ein verbessertes Notification Framework, ein stark überarbeitetes Navigation-Konzept, Android Beam und Wi-Fi Direct sind nur einige der Highlights. Und auch Android 4.2 steht dem in puncto neuer Features in nichts nach. Die Session zeigt die besten Features der Post-4.0-Ära.

Statistics

Views

Total Views
889
Views on SlideShare
875
Embed Views
14

Actions

Likes
0
Downloads
15
Comments
0

1 Embed 14

http://www.openknowledge.de 14

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • http://developer.android.com/design/patterns/notifications.html http://developer.android.com/guide/topics/ui/notifiers/notifica tions.html
  • Note: If you're using the icon to navigate to the home activity, beware that beginning with Android 4.0 (API level 14), you must explicitly enable the icon as an action item by calling setHomeButtonEnabled(true) (in previous versions, the icon was enabled as an action item by default).
  • Remember to use the FLAG_ACTIVITY_CLEAR_TOP flag in the Intent , so that you don 't cre ate a new instance of the parent activity if one already exists. For instance, if you don't use the FLAG_ACTIVITY_CLEAR_TOP flag, then after navigating up, the BACK button will actually take the user "forward", with respect to the application structure, which would be strange.
  • http://developer.android.com/about/versions/android-4.1.html appstack navigation
  • Remember to use the FLAG_ACTIVITY_CLEAR_TOP flag in the Intent , so that you don 't cre ate a new instance of the parent activity if one already exists. For instance, if you don't use the FLAG_ACTIVITY_CLEAR_TOP flag, then after navigating up, the BACK button will actually take the user "forward", with respect to the application structure, which would be strange.
  • Note: If you're using the icon to navigate to the home activity, beware that beginning with Android 4.0 (API level 14), you must explicitly enable the icon as an action item by calling setHomeButtonEnabled(true) (in previous versions, the icon was enabled as an action item by default).
  • http://developer.android.com/sdk/android-4.0.html Android Beam for NFC-based sharing Android Beam is an innovative, convenient feature for sharing across two NFC-enabled devices, It lets people instantly exchange favorite apps, contacts, music, videos — almost anything. It’s incredibly simple and convenient to use — there’s no menu to open, application to launch, or pairing needed. Just touch one Android-powered phone to another, then tap to send. For sharing apps, Android Beam pushes a link to the app's details page in Google Play. On the other device, the Google Play client app launches and loads the details page, for easy downloading of the app. Individual apps can build on Android Beam to add other types of interactions, such as passing game scores, initiating a multiplayer game or chat, and more. Android Beam is an NFC-based feature that lets users instantly share information about the apps they are using, just by touching two NFC-enabled phones together. When the devices are in range — within a few centimeters — the system sets up an NFC connection and displays a sharing UI. To share whatever they are viewing with the other device, users just touch the screen. For developers, Android Beam is a new way of triggering almost any type of proximity-based interaction. For example, it can let users instantly exchange contacts, set up multiplayer gaming, join a chat or video call, share a photo or video, and more. The system provides the low-level NFC support and the sharing UI, while the foreground app provides lightweight data to transfer to the other device. Developers have complete control over the data that is shared and how it is handled, so almost any interaction is possible. For larger payloads, developers can even use Android Beam to initiate a connection and transfer the data over Bluetooth, without the need for user-visible pairing. Even if developers do not add custom interactions based on Android Beam they can still benefit from it being deeply integrated into Android. By default the system shares the app’s Google Play URL, so it’s easy for the user to download or purchase the app right away.
  • http://developer.android.com/guide/topics/wireless/wifip2p.html Developers can use a framework API to discover and connect directly to nearby devices over a high-performance, secure Wi-Fi Direct connection. No internet connection or hotspot is needed. Wi-Fi Direct opens new opportunities for developers to add innovative features to their applications. Applications can use Wi-Fi Direct to share files, photos, or other media between devices or between a desktop computer and an Android-powered device. Applications could also use Wi-Fi Direct to stream media content from a peer device such as a digital television or audio player, connect a group of users for gaming, print files, and more. Listener interface Associated actions WifiP2pManager.ActionListener : connect() , cancelConnect() , crea teGroup() , removeGroup() , and discoverPeers() WifiP2pManager .ChannelL istener: in itialize() Wifi P2pManager.Connec tionInfoListe ner : requestCon nectInfo() Wi fiP2pManager.GroupI nfoListener : re questGroupInfo() WifiP2pManager.PeerListListener : requestPeers()
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html http://blog.stylingandroid.com/archives/1394 http://blog.stylingandroid.com/archives/1413 http://blog.st ylingandroid.com/archives/1435
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • http://developer.android.com/about/versions/jelly-bean.html
  • Kurzes Beispiel selber implementieren: User anlegen und auf nächster Seite darstellen - inkl. UserController und Backend.

Android 4.1/4.2 Android 4.1/4.2 Presentation Transcript

  • Android 4.1+ @mobileLarson @_openKnowledge Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA Lars Röwekamp | CIO New Technologies
  • Notifications Navigation Fragments ConnectivityAgenda ... and Stuff Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • Notifications Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Was bisher geschah ...‣Notifications zum Informieren überÄnderungen innerhalb der App‣Notification Area und Drawer als „Medium“zur Darstellung der Änderungsinformation
  • MTC Notifications Android 4.1+ - Noteworthy ...2013
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Seit Jelly Bean können Notifications ...‣... variabel in ihrer Größe sein‣... auf- und zugeklappt werden‣... verschiedene Aktionen anstoßen‣... eine Priorität besitzten
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Basis Layout
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Expanded Layout‣Inbox‣BigPicture‣BigText‣Custom Layout‣Expanded Style‣Compressed Style
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Expanded Layout
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Actions
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Actions‣Darstellung als Button‣bis zu 3 Actions direkt anzeigbar‣alternativ „more“ Icon für Overflow‣Pending Intents zur Starten der Aktion
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Priorities
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Stacking
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notification Stacking & Expanded Layout
  • MTC Notifications Android 4.1+ - Noteworthy ...2013BTW: Notification Best Practices
  • MTC Notifications Android 4.1+ - Noteworthy ...2013BTW:Kids,don‘t trythis athome!
  • MTC Notifications Android 4.1+ - Noteworthy ...2013// Intent to call if notification is selectedIntent intent = new Intent(this, MyActivity.class);PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);// Build up notification with some dummy actionsNotification notification = new Notification.Builder(this) .setContentTitle("New Message from " + "@mobileLarson") .setContentText("Hi, what‘s up?") .setSmallIcon(R.drawable.new_msg_icon) .setContentIntent(pIntent) .addAction(R.drawable.answer_icon, "Answer", pIntent) .addAction(R.drawable.more_icon, "More", pIntent).build();// Set notification flag(s)notification.flags = Notification.FLAG_AUTO_CANCEL;// Retrieve notification service and send notificationNotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);notificationManager.notify(0, notification);
  • MTC Notifications Android 4.1+ - Noteworthy ...2013 // Intent to call if notification is selected Intent intent = new Intent(this, MyActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); // Build up expandable notification with some dummy actions Notification notification = new Notification.Builder(this) .setContentTitle("New Message from " + "@mobileLarson") .setContentText("Hi, what‘s up?") .setSmallIcon(R.drawable.new_msg_icon) .setContentIntent(pIntent) .addAction(R.drawable.answer_icon, "Answer", pIntent) .addAction(R.drawable.more_icon, "More", pIntent) .setStyle(new Notification.BigTextStyle().bigText("...")) .build(); ...oder BigPictureStyleoder BigPictureStylebzw. InboxStylebzw. InboxStyle
  • MTC Notifications Android 4.1+ - Noteworthy ...2013
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Eigentlich ganz einfach, aber ...‣... was ist mit Notification Stacking?‣... was ist mit Abwärtskompabilität?‣... was ist mit Navigation?
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notifications & Stacking‣eindeutige noteID als Hinweis für denNotification Manager verwenden, dass erdie selbe Notification-Darstellung nutzensoll‣notificationManager.notify(noteID,notification)
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notifications & Abwärtskompabilität‣NotificationCompat‣NotificationCompat.Builder‣Action Buttons erscheinen erst ab V4.1+
  • MTC Notifications Android 4.1+ - Noteworthy ...2013NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)    .setSmallIcon(R.drawable.notification_icon)    .setContentTitle("Event Tracker")    .setContentText("Events Received");// Sets and configure the specific styleNotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();inboxStyle.setBigContentTitle("Event tracker details:")  .addLine("first line")  .addLine("second line")  .addLine("third line")  .setSummeryText("+3 more"); // Moves the big view style object into the notification object.mBuilder.setStyle(inBoxStyle);Notification notification = mBuilder.build();...
  • MTC Notifications Android 4.1+ - Noteworthy ...2013Notifications & Navigation‣dazu gleich mehr ...
  • Navigation Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • MTC Navigation Android 4.1+ - Noteworthy ...2013Was bisher geschah ...‣Android 4.0 führt Unterscheidungzwischen „Back vs. Up“ Navigation ein
  • MTC Navigation Android 4.1+ - Noteworthy ...2013Back vs. Up Navigation
  • MTC Navigation Android 4.1+ - Noteworthy ...2013
  • MTC Navigation Android 4.1+ - Noteworthy ...2013
  • MTC Navigation Android 4.1+ - Noteworthy ...2013
  • MTC Navigation Android 4.1+ - Noteworthy ...2013
  • MTC Navigation Android 4.1+ - Noteworthy ...2013
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Deep Dive
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Step 1: Enable „Up Navigation“ Step 1: Enable „Up Navigation“@Override   public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); ...}
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Step 2: Realize „Up Navigation“ Step 2: Realize „Up Navigation“@Overridepublic boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // app icon in action bar clicked: go home case android.R.id.home: Intent i = new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); }}
  • MTC Navigation Android 4.1+ - Noteworthy ...2013Eigentlich ganz einfach, aber ...‣... ziemlich viel Aufwand, oder?‣... was ist mit „deep dive“ Intents?
  • MTC Navigation Android 4.1+ - Noteworthy ...2013Navigation & „Deep Dive“ Intents‣Einsprung von außen „mitten“ in die App‣Navigation Stack wird künstlich aufgebauta.k.a. Synthetic Back Stack‣Was ist mit dem fehlenden Kontext?„Music Details“ navigiert zurück zur „MusicListe“, aber zu welcher?
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Deep Dive
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Step 1: Enable „Up Navigation“ Step 1: Enable „Up Navigation“<activity  android:name=".MainActivity"  android:label="@string/app_name" >  <intent-filter> ... </intent-filter></activity><activity android:name=".ResultActivity"    android:parentActivityName=".MainActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"/></activity>
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Step 2: Realize „Up Navigation“ Step 2: Realize „Up Navigation“@Overridepublic boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // app icon in action bar clicked: go home case android.R.id.home: Intent i = new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); }}
  • MTC Navigation Android 4.1+ - Noteworthy ...2013 Step 3: Manipulate Intent Data Step 3: Manipulate Intent Data@Override   public void onPrepareNavigateUpTaskStack( TaskStackBuilder builder) { // retrieve intent for manipulation int position = ...; Intent intent = builder.getIntentAt(position); // manipulate intent intent.putExtra(INTENT_SPECIFIC_INFO, specificInfo); ...}
  • Fragments Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Was bisher geschah ...‣Android 4.0 führt Fragments als Konzeptzur Modularisierung ein‣Wiederverwendbare Blöcke zurGestaltung von „Multi-Pane“ Layouts
  • MTC Fragments Android 4.1+ - Noteworthy ...2013
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Fragments 1x1‣UI Fragments als Building Blocks‣UI Activity Layout als Block Assembler‣UI Activity Class als Block Assembler Logic‣UI Resources als Switch
  • MTC Fragments Android 4.1+ - Noteworthy ...2013
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Fragments im Detail‣Activity Modul a.k.a. Sub Activity‣inkl. eigener UI‣inkl. eigenem Lifecycle‣benötigt immer eine umliegende Activity‣Lifecycle passt sich dem Activity-Lifecyclean
  • MTC Fragments Android 4.1+ - Noteworthy ...2013
  • MTC Fragments Android 4.1+ - Noteworthy ... 2013 in Aktion ‣ Starte MainActivity ‣ Screensize Smartphone ‣ Orientierung Portrait ‣ Layout aus res/layout ‣ Fragment A 1) ‣ Bei Selektion schicke Intent „Details“ ‣ Zeige DetailsActivity in Fragment B1) Standardlayout
  • MTC Fragments Android 4.1+ - Noteworthy ... 2013 in Aktion ‣ Starte DetailActivity ‣ Screensize Smartphone ‣ Orientierung Portrait ‣ Layout aus res/layout 1) ‣ Fragment B1) Standardlayout
  • MTC Fragments Android 4.1+ - Noteworthy ... 2013 in Aktion ‣ Starte MainActivity ‣ Screensize Tablet ‣ Orientierung Landscape 1) ‣ Layout aus /res/layout-sw600dp ‣ Fragment A und B ‣ Bei Selektion aktualisiere B1) Layout für: smalest witdh 600dp = 10“ Tablet
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Fragment Main Player‣Fragment XML‣Fragment Class‣FragmentManager‣FragmentTransaction
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Fragments‣Soweit alles klar, aber wie kann ichein Fragment innerhalb eines anderenFragments platzieren?
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Nested Fragments‣Verschachtelte Fragments‣dynamisch via FragmentManagerhinzufügen, aktualisieren, löschen‣können nicht statisch via XML Layoutangegeben werden!
  • MTC Fragments Android 4.1+ - Noteworthy ...2013Nested Fragments
  • MTC Fragments Android 4.1+ - Noteworthy ...2013...@Overridepublic void onClick(View v) { Fragment nestedFragment = new NestedFrag(); FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); transaction.add(getId(), nestedFragment, "parent").commit();}...
  • MTC Notifications Android 4.1+ - Noteworthy ...2013
  • Connectivity Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • MTC Connectivity Android 4.1+ - Noteworthy ...2013Was bisher geschah ...‣Einführung vereinfachter Connectivityzwischen zwei Android Devices in Android4.0‣via NFC a.k.a. Android Beam‣via WiFi a.k.a. WiFi Direct
  • MTC Connectivity Android 4.1+ - Noteworthy ...2013Android Beam‣Datenaustausch zwischen zwei „NFC-Devices“‣Beam API liefert UI und NFC Support‣Game Score, Chat Data, Contacts,Apps ...‣Kleine Datenmengen via NFC‣Große Datenmengen via Bluetooth‣Apps via Google Play
  • MTC Connectivity Android 4.1+ - Noteworthy ...2013Android Beam Transfer für „große“ Daten‣Transfer via Bluetooth oder Alternativen‣Transparente Verbindung im Hintergrund‣Aktivieren via „static“ content „static“ content‣setBeamPushUris oder‣NfcAdapter.CreateBeamUrisCallback „dynamic“ „dynamic“ content content
  • MTC Connectivity Android 4.1+ - Noteworthy ...2013WiFi Direct‣P2P-Verbindung zu „Nearby-Devices“ viaWiFi‣Kein Internet oder Tethering notwendig‣WifiP2PManager als Main Player‣Peer Discovery, Request & Connecting
  • MTC Connectivity Android 4.1+ - Noteworthy ...2013WiFi Direct Service Discovery‣Finden & Filtern von „Nearby Device“Services‣Basiert auf Android Network ServiceDiscovery‣Main Player WifiP2pManager - Service ...‣anbieten: addLocalService‣nutzen: addServiceRequest &
  • Connectivity Some Stuff Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013‣ Developer Options‣ Security Enhancements‣ Performance Improvements
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Developer Options „7x die Builde-No‣SEVEN is the magic number anklicken, um Dev Options zu‣Take Bug Report aktivieren.“‣Power Menu Bug Reports‣Verify App over USB‣Simulate secondary Display‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Developer Options‣SEVEN is the magic number Screenshot,‣Take Bug Report Device State Info Dump,‣Power Menu Bug Reports eMail-Report‣Verify App over USB‣Simulate secondary Display‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Developer Options‣SEVEN is the magic number‣Take Bug Report Power Menu‣Power Menu Bug Reports Option für Bug‣Verify App over USB Reports‣Simulate secondary Display‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Developer Options‣SEVEN is the magic number‣Take Bug Report‣Power Menu Bug Reports App Check für‣Verify App over USB USB ausschalten‣Simulate secondary Display‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Developer Options‣SEVEN is the magic number‣Take Bug Report‣Power Menu Bug Reports‣Verify App over USB Power Menu‣Simulate secondary Display Option für Bug‣... Reports
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Security Enhancements Application Scan‣Application Verification vor der‣Premium SMS Control Installation‣Always-on VPN‣Improved Permission Display‣Content Provider Defaults‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Security Enhancements‣Application Verification Notification falls‣Premium SMS Control Premium SMS‣Always-on VPN‣Improved Permission Display‣Content Provider Defaults‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Security Enhancements‣Application Verification‣Premium SMS Control Net Traffic nur‣Always-on VPN bei VPN erlaubt‣Improved Permission Display‣Content Provider Defaults‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Security Enhancements‣Application Verification‣Premium SMS Control‣Always-on VPN Gruppierung und‣Improved Permission Display bessere Info‣Content Provider Defaults‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Security Enhancements‣Application Verification‣Premium SMS Control‣Always-on VPN‣Improved Permission Display‣Content Provider Defaults NOT exported‣...
  • MTC Some Stuff Android 4.1+ - Noteworthy ...2013Performance Improvements‣vsync Timing‣Tripple Buffering Deutlich‣Reduced Touch Latency verbesserte Performance und‣CPI Input Boost Ergonomie‣Optimized Drawing‣...
  • Android 4.1+ @mobileLarson @_openKnowledge Photo credit: Kalexanderson / Foter.com / CC BY-NC-SA Lars Röwekamp | CIO New Technologies