Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Marshmallow demos

Android Marshmallow demos

GDG Meetup -
Review some of the Android Marshmallow features, code and discuss best practices.

Yossi Elkrief

September 09, 2015
Tweet

More Decks by Yossi Elkrief

Other Decks in Programming

Transcript

  1. Getting follow-up user input • Music App • “play some

    music” • “what genre?” • Home Automation App • “OK Google, turn on the lights” • “which room?” • Verifying that an activity should complete • “Are you sure?”
  2. Voice Interactions VoiceInteractor 
 used for response prompting and confirmation


    <activity android:name=“com.demoapps.activities.DemoVoice”>
 <intent-filter>
 <action android:name=“com.demoapps.DEMO_ACTION_INTENT” />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.VOICE" />
 </intent-filter>
 </activity>
  3. Voice Interactions class DemoVoice extends Activity {
 @Override
 public void

    onResume() {
 if (isVoiceInteraction()) {
 // do our voice stuff here
 }
 finish();
 }
 }
  4. Voice Interactions class VoiceConfirm extends
 VoiceInteraction.ConfirmationRequest {
 
 public VoiceConfirm(String

    prompt) {
 super(prompt, null);
 }
 
 @Override
 public void onConfirmationResult(
 boolean confirmed, Bundle null) {
 if (confirmed) {
 // do voice stuff
 }
 finish();
 }
 }; class DemoVoice extends Activity {
 @Override
 public void onResume() {
 if (isVoiceInteraction()) {
 getVoiceInteractor(). sendRequest(new VoiceConfirm(userPromptString));
 } else {
 finish();
 } } }
  5. “Google's 'Now on Tap' is Android's next killer feature” (CNET)

    “Google Now on Tap is the coolest Android feature” (ANDROIDPIT) “The next evolution of the digital concierge” (Tech Republic)
  6. • Scans your screen only when you press and hold

    the Home button • Fully opt-in feature • Work out of the box with any app
  7. Icons in Notifications Presented in Google IO 2015 Notification myNotification

    = new Notification.Builder(context) .setSmallIcon(noti_icon).build(); Icon noti_icon = Icon.createWithResource(context, R.drawable.app_ic_notification);
  8. Icons in Notifications Presented in Google IO 2015 Notification myNotification

    = new Notification.Builder(context) .setSmallIcon(noti_icon).build(); Icon noti_icon = Icon.createWithResource(context, R.drawable.app_ic_notification); Icon noti_icon = Icon.createWithBitmap(myIconBitmap);
  9. Icons in Notifications Presented in Google IO 2015 Notification myNotification

    = new Notification.Builder(context) .setSmallIcon(noti_icon).build(); Icon noti_icon = Icon.createWithResource(context, R.drawable.app_ic_notification); Icon noti_icon = Icon.createWithBitmap(myIconBitmap); 72°
  10. android.graphics.drawable.Icon Presented in Google IO 2015 Can be either: Drawable

    resource id Bitmap PNG or JPEG represented by a byte[]
  11. Text Selection Easier selection Floating palette with action items Default

    for TextView Other views set ActionMode.TYPE_FLOATING Presented in Google IO 2015
  12. [{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "com.example.myapp", "sha256_cert_fingerprints":

    ["01:23:45:67:89:AB:CD:..."] } }] https://example.com/.well-known/statements.json Presented in Google IO 2015
  13. [{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "com.example.myapp", "sha256_cert_fingerprints":

    ["01:23:45:67:89:AB:CD:..."] } }] https://example.com/.well-known/statements.json keytool -list -v -keystore release.keystore Presented in Google IO 2015
  14. Direct Share <activity ... >
 <intent-filter>
 <action android:name="android.intent.action.SEND" />
 </intent-filter>


    <meta-data android:name="android.service.chooser.chooser_target_service"
 android:value=".MyService" />
 </activity>
  15. Direct Share <activity ... >
 <intent-filter>
 <action android:name="android.intent.action.SEND" />
 </intent-filter>


    <meta-data android:name="android.service.chooser.chooser_target_service"
 android:value=".MyService" />
 </activity>
  16. Direct Share <activity ... >
 <intent-filter>
 <action android:name="android.intent.action.SEND" />
 </intent-filter>


    <meta-data android:name="android.service.chooser.chooser_target_service"
 android:value=".MyService" />
 </activity> <service android:name=".MyService"
 android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
 <intent-filter>
 <action android:name="android.service.chooser.ChooserTargetService" />
 </intent-filter>
 </service>
  17. Direct Share <activity ... >
 <intent-filter>
 <action android:name="android.intent.action.SEND" />
 </intent-filter>


    <meta-data android:name="android.service.chooser.chooser_target_service"
 android:value=".MyService" />
 </activity> <service android:name=".MyService"
 android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
 <intent-filter>
 <action android:name="android.service.chooser.ChooserTargetService" />
 </intent-filter>
 </service> public class MyService extends ChooserTargetService {
 @Override
 public List<ChooserTarget> onGetChooserTargets(ComponentName name, IntentFilter filter); {
 // ...
 }
 }

  18. Direct Share <activity ... >
 <intent-filter>
 <action android:name="android.intent.action.SEND" />
 </intent-filter>


    <meta-data android:name="android.service.chooser.chooser_target_service"
 android:value=".MyService" />
 </activity> <service android:name=".MyService"
 android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
 <intent-filter>
 <action android:name="android.service.chooser.ChooserTargetService" />
 </intent-filter>
 </service> public class MyService extends ChooserTargetService {
 @Override
 public List<ChooserTarget> onGetChooserTargets(ComponentName name, IntentFilter filter); {
 // ...
 }
 }