Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android Wear のムダ知識

Android Wear のムダ知識

  1. 1. 䈜䈜䚷ὀព䚷䈜䈜 Android Wear 䛻䛴䛔䛶䛾䝮䝎䛺ヰ䜢䛧䜎䛩䚹 30ศ㛫䝮䝎䛺ヰ䛻䛚௜䛝ྜ䛔䛟䛰䛥䛔䚹 䛔䜔䛺䜙⪺䛛䛺䛟䛶䛔䛔䜣䛰䜘䠛
  2. 2. Android Wear 䛾䝮䝎▱㆑ ᪥ᮏAndroid䛾఍ ⚄ᡞᨭ㒊 㔝⏣ᝅᚿ
  3. 3. 䝮䝎䛺ヰ䚷䛭䛾1 ྡ๓䠖 䚷㔝⏣ᝅᚿ 䚷@scarviz䚷←ᐇ䛿䜒䛖౑䛳䛶䛺䛔 ᡤᒓ䠖 䚷᪥ᮏAndroid䛾఍ ⚄ᡞᨭ㒊䚷←ᐇ䛿䜎䛰䛒䛳䛯 䚷GDG⚄ᡞ←ᐇ䛿䛒䛳䛯
  4. 4. OK! Google!
  5. 5. ᛀ䜜䛶䜎䛫䜣䛛䠛
  6. 6. …ఱ䛜㐪䛖䛾䠛
  7. 7. 䛺䜣䛸䛛䛫䛽䜀䟿
  8. 8. 'Difficult meeting' by Simon Blackley. CC BY-ND 2.0 http://goo.gl/Oh1LWu
  9. 9. MediaRecorder
  10. 10. Mediarecorder start failed -2147483648 䛳䛶㉸䜔䜛Ẽ䛾䛺䛔౛እ…
  11. 11. ↑䛣䜣䛺䛾䛸䛛 ↑䛣䜣䛺䛾䛸䛛
  12. 12. AV
  13. 13. VideoView
  14. 14. VideoView(䛸MediaPlayer) Error: 1,-2147483648 MP4(H.264AVC)䛸3GPP(H.263) 䝃䜲䝈䛿280×280䛻཰䜎䜛䜘䛖䛻䝸䝃䜲䝈῭䜏
  15. 15. Media㛵㐃䛿࿧䜉䜛䛡䛹 䝎䝯䛳䜍䛔…
  16. 16. http://developer.android.com/intl/ja/training/wearables/apps/index.html
  17. 17. Bluetooth䛷⮬⏤䛻 ㏻ಙ䛷䛝䜛䟿
  18. 18. Bluetoothᶵჾ䜢᳨ฟ䛧䛶䜏䜛
  19. 19. 䛣䜜䛿BT 䝦䝑䝗䝩䞁→
  20. 20. AndroidWear䜢᳨ฟ䛥䛫䜛
  21. 21. ActivityNotFoundException䛷 ⴠ䛱䜛 BluetoothAdapter. ACTION_REQUEST_DISCOVERABLE䛷Intent ᢞ䛢䛶䜒䝎䝯䛳䜍䛔䚹
  22. 22. 'Thinker @ U of L' by Angela http://goo.gl/isFoTC CC BY-NC-ND 2.0
  23. 23. Bluetoothᶵჾ䛸䛧䛶᳨ฟ䛥䜜 䜛䛛䛹䛖䛛䛿ၥ㢟䛨䜓䛺䛔
  24. 24. 䛣䜜䛷ఱ䛜䛧䛯䛔䛛䛜 ၥ㢟䛺䜣䛰
  25. 25. http://www.android.com/wear/
  26. 26. Android4.0
  27. 27. ൅䜒䜏䜣䛺䜏䛯䛔䛻 䛂Notification䜑䛳䛱䜓౽฼䟿䛃 䛳䛶ゝ䛳䛶䜏䛯䛔䜣䛰䜘䟿
  28. 28. NotificationⓎ⏕ AccessibilityService䛷ᣠ䛖 BluetoothService䛷㏻ಙ ↑䜎䛪䛿䛣䛣 Notification 䜢Ⓨ⏕䛥䛫䜛
  29. 29. Bluetooth㏻ಙ䛾ὶ䜜 䝇䝬䞊䝖䝣䜷䞁䜢 Wear䛜᳨ฟ䛩䜛 BT᥋⥆䛩䜛 Notification᝟ሗ䜢㏦䜛
  30. 30. BluetoothAdapter.ACTION_ REQUEST_DISCOVERABLE 䛷Intent䜢ᢞ䛢䜛 BluetoothAdapter. listenUsingRfcommWithServiceRecord䛷 BluetoothServerSocket䜢ྲྀᚓ䛧䚸accept䛷 ᥋⥆䜢ᚅ䛱ཷ䛡䜛 BluetoothSocket.getOutputStream 䛷Notification᝟ሗ䜢᭩䛝㎸䜐 IntentFilter䛸BroadcastReceiver 䜢Ⓩ㘓䛧䚸 BluetoothAdapter.startDiscovery 䝯䝋䝑䝗䛷➃ᮎ䜢ぢ䛴䛡䜛 ➃ᮎ䛾䜰䝗䝺䝇䛛䜙 BluetoothAdapter.getRemoteDevice䛷䚸 BluetoothDevice䜢ྲྀᚓ䛧䚸 createRfcommSocketToServiceRecord 䛷㏻ಙ䛷䛝䜛䜘䛖䛻䛩䜛 BluetoothSocket.getInputStream 䛷Notification᝟ሗ䜢ㄞ䜏㎸䜐 䛣䜜䜙䛾Bluetooth㏻ಙ䛿Service䛷⾜䛖
  31. 31. NotificationⓎ⏕ AccessibilityService䛷ᣠ䛖 BluetoothService䛷㏻ಙ ↑䛷䛝䛯 Notification ←䛴䛞䛣䛣 䜢Ⓨ⏕䛥䛫䜛
  32. 32. Notification䛿 AccessibilityService䛷ᣠ䛖 䛸䛿䛔䛳䛯䜒䛾䛾…
  33. 33. Notification᝟ሗ䛜 䛹䛖䛔䛖ᙧᘧ䛷䛟䜛䛾䛛 ඲↛䜟䛛䜣䛺䛔
  34. 34. ḧ䛧䛔᝟ሗ 1. 䝍䜲䝖䝹 2. 䜰䜲䝁䞁 3. 䝔䜻䝇䝖 4. 䝟䝑䜿䞊䝆ྡ(䜾䝹䞊䝥ྡ䛻䛩䜛)
  35. 35. AccessibilityEvent.getParcelableData䛛䜙䚸 RemoteView䛷Notification䛾䝺䜲䜰䜴䝖ྲྀᚓ 䛣䛣䛛䜙䝸䝋䞊䝇ID䛻android.R.id.titleᣦᐃ 䝍䜲䝖䝹䜢ྲྀᚓ 1. 䝍䜲䝖䝹
  36. 36. 2. 䜰䜲䝁䞁 䝍䜲䝖䝹䛸ྠ䛨䛟Notification䛾 䝺䜲䜰䜴䝖䛛䜙ྲྀᚓ䛩䜛 䝸䝋䞊䝇ID䛻android.R.id.iconᣦᐃ 䜰䜲䝁䞁䜢ྲྀᚓ PackageManager.getApplicationIcon䛷 䜰䝥䝸䜰䜲䝁䞁䛾᪉䛜Ⰻ䛥䛭䛖
  37. 37. 3. 䝔䜻䝇䝖 AccessibilityEvent.getText䛷 䝔䜻䝇䝖䜢ྲྀᚓ 䛣䜜䛿Ticker䛻タᐃ䛥䜜䛶䛔䜛ᩥᏐิ Notification䛾䝺䜲䜰䜴䝖䛛䜙䝸䝋䞊䝇ID䛻android. R.id.text䛺䛹䜢ᣦᐃ䛧䛶䜒✵䛳䜍
  38. 38. 4. 䝟䝑䜿䞊䝆ྡ AccessibilityEvent.getPackageName䛷 䝟䝑䜿䞊䝆ྡ䜢ྲྀᚓ
  39. 39. Notification௨እ䛻䜒 Ⰽ䚻㣕䜣䛷䛟䜛
  40. 40. accessibility_service.xml䜢⏝ព䛧䛶 android:accessibilityEventTypes䛻 "typeNotificationStateChanged" 䜢タᐃ
  41. 41. Notification䛾㑅ู GooglePlay䝇䝖䜰䛾㏻▱䜔䚸䜰䝑䝥䝕䞊䝖ྍ⬟䜰䝥䝸䛛䜙䛾㏻▱䛿ཷ䛡ྲྀ䜛 䛭䜜௨እ䛾䝅䝇䝔䝮(䝥䝸䜲䞁䝇䝖䞊䝹)䛾䜒䛾䛿↓ど䛩䜛 if(!packageName.startsWith("com.android.vending") && ((ai.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 0) && ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0))䚷{ // 䛣䜜䜙䛿↓ど䛩䜛 } ai䛿ApplicationInfo(PackageManager䛛䜙ApplicationInfo䜢ྲྀᚓ)
  42. 42. NotificationⓎ⏕ AccessibilityService䛷ᣠ䛖 ཷ䛡ྲྀ䛳䛯᝟ሗ䜢 Notification.Builder 䛻ワ䜑䜛䛰䛡 BluetoothService䛷㏻ಙ ↑䛷䛝䛯 Notification ↓ ←䛷䛝䛯 䜢Ⓨ⏕䛥䛫䜛
  43. 43. 䛣䜣䛺ឤ䛨 Notification.Builder notification = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(notifyInfo.Title) .setContentText(notifyInfo.Text) .setGroup(notifyInfo.GroupName) .setStyle(new Notification.BigPictureStyle() .bigPicture(notifyInfo.Icon)); ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) .notify(GetNotifyId(), notification.build()); ←bigPicture䛻タᐃ䛩䜛
  44. 44. Notification 䜢㏦䛳䛶䜏䜛
  45. 45. 䛷䛝䛯!!
  46. 46. Android4.0௨㝆䛸AndroidWear䜢 Bluetooth⤒⏤䛷㏻▱䛩䜛䝃䞁䝥䝹 https://github.com/scarviz/SampleBTNotification
  47. 47. 䛤Ύ⫈䛒䜚䛜䛸䛖䛤䛦䛔䜎䛧䛯䟿

×