SlideShare ist ein Scribd-Unternehmen logo
1 von 11
マ テ リ ア ル デ ザ イ ン と
A W S P i n p o i n t
と 戦 っ た お 話
teradonburi
• 元ソフトバンクでかざして募金アプリ(iOS、Android)とか作りました
• dely株式会社でKURASHIRUという料理動画アプリのAndroid担当してます
• Qiitaやってます
• 猫と料理好きです
• LT初めてなので優しくしてね(はぁと
マテリアルデザインの苦悩
• マテリアルデザインではまったところ
– rippleアニメーション
android:background="?attr/selectableItemBackground"
– Elevation属性
そもそもAndroid4以下で属性がないので擬似drawable作成で代
用
– FloatingActionButton
公式サポートライブラリで
Android4で背景色の動的変更できない
サードパーティライブラリで代用
– BottomNavigation
公式サポートライブラリでガイドラインのスクロールで隠れる
が未対応(^ω^#)ビキビキ
サードパーティライブラリで代用
(ライブラリでも文字サイズが変更できない!)
実力行使
対策:ライブラリ内privateメンバーの上書き
BottomNavigationの
TextViewがライブラリ内privateメンバで
publicメソッドが提供されてないため
フォントサイズが変えられない(^p^)
(項目和名だとガイドライン無視してサイズ変えたい)
@SuppressWarnings("unchecked")
void setBottomBarTabItem(BottomNavigationBar bottombar){
// ボトムバータブのprivateメンバをハックする
try {
Field tabs = bottombar.getClass().getDeclaredField("mBottomNavigationTabs");
tabs.setAccessible(true);
List<Object> navigationTabs = (List<Object>)tabs.get(bottombar);
for(int i = 0;i < navigationTabs.size();++i){
Field label =
navigationTabs.get(i).getClass().getSuperclass().getDeclaredField("labelView");
label.setAccessible(true);
TextView labelText = (TextView)label.get(navigationTabs.get(i));
labelText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.bottombar_textsize));
}
}
catch (Exception e){
e.printStackTrace();
}
}
# BottomBar
-keepnames class com.ashokvarma.bottomnavigation.**
{ *; }
Proguardで名前変えられたら
リリースビルドapkで落ちるので注意
AWS Pinpointではまる
• プッシュ通知用にAWS Pinpointを導入(2016年12月サポート開始)
– Android4でのフォアグラウンドの挙動おかしくね?
– AWS SDK内で割と落ちる
– FCMサポートしてるって書いてるけど使い物にならなかったよ・・・
実力行使
private boolean isForeground() {
// Gets a list of running processes.
ActivityManager am = (ActivityManager)
pinpointContext.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> tasks = am.getRunningAppProcesses();
// On some versions of android the first item in the list is what runs in the foreground,
// but this is not true on all versions. Check the process importance to see if the app
// is in the foreground.
final String packageName = pinpointContext.getApplicationContext().getPackageName();
for (ActivityManager.RunningAppProcessInfo appProcess : tasks) {
final String processName = appProcess.processName;
if (ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND == appProcess.importance
&& packageName.equals(processName)) {
return true;
}
}
return false;
}
対策:ライブラリ内メソッドの踏襲
AWS SDK内でAndroid4以下のフォアグラウンドの判定が間違ってる (・∀・)カエレ!!
対策:ライブラリ内メソッドの踏襲
if (NotificationClient.CampaignPushResult.APP_IN_FOREGROUND.equals(pushResult)) {
// If the app was in the foreground, you may want to add logic here to send
// a broadcast back to your main activity to show something to the user.
appContext = getApplicationContext();
// AWS SDKの処理ではAndroid Forgroundの判定が足りないので正しく判定(Android 4)
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP){
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
if (am.getRunningTasks(1).get(0).topActivity.getPackageName().equals(getApplicationContext().getPackageName())) {
// ここにフォアグラウンドの場合の処理を実装
showPopup(data);
}
else{
// バックグラウンドの処理はAWS SDK内部処理を踏襲したメソッドを実装・・・(通知バナー表示)
handleCampaignPush(data,this.getClass());
}
}
else{
// Android 5以上のフォアグラウンド処理
showPopup(data);
}
}
// AWS SDKライブラリ内部のメソッドをアレンジ/(^o^)\
private void handleCampaignPush(final Bundle data, final Class<?> targetClass) {
・・・
}
対策:Try Catch NullException
Crashlyticsでクラッシュログ見ると
AWS SDK内で
ぬるぽで結構落ちてた \(^o^)/
@Override
public AWSCredentials getCredentials() {
// Pinpoint SDK v2.3.8にはバグがある
// https://github.com/aws/aws-sdk-android/issues/233 (Issues投げました)
try{
return underlyingProvider.getCredentials();
}catch (NullPointerException e){
throw new AmazonServiceException("credentials null error");
}
}
まとめ
• マテリアルデザイン
– そもそも公式サポートがAndroid5以上なのでAndroid4対応しんどい
– 公式サポートライブラリがガイドラインをカバーしきれてない(怒
– サードパーティライブラリでもカバーできないところは実力行使で
(レイアウトの組み合わせでできなかったりもするので注意)
• AWS SDK for Android
– 公式ライブラリにバグがないとは限らない(特に出たてのサービスは・・・)
– バグ報告は公式GitHubにIssuesやpull request投げましょう
– 出たてのサービスをどうしても使う場合は実力行使で
privateやめてくださいしんでしまいます
(^p^)
から金のドロイド君が届きました
Google Play 2016 ベスト自己改善アプリ(KURASHIRU)
弊社では絶賛Androidエンジニア募集中です!
オフィス訪問からでも歓迎です。
Wantedlyより募集中です。
個人的にでも声かけてください。

Weitere ähnliche Inhalte

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Shibuya.apk

Hinweis der Redaktion

  1. 今日は、マテリアルデザインとAWS Pinpointではまった話と解決策についてざらっと紹介します。