Skip to content

Instantly share code, notes, and snippets.

View im182cm's full-sized avatar

Philip Jung im182cm

  • Branch International
  • San Francisco
View GitHub Profile
@im182cm
im182cm / gist:b72d9e4de22c81ca5c4ce3d7bd9a577f
Last active December 6, 2017 04:26
How to exclude gradle dependencies

Volume down apk size with gralde exclude

Why Should I use it?

  1. cause of multidex problem
    Some of apps doesn't support multidex option, due to support low version below Lollipop.
    In my case, I was using Facebook SDK to implement social login, but with recent version of SDK, v4.28. My app's method counts was over to 65K. However I was supporting from Kitkat, so I should exclude some libraries not using.
  2. To reduce apk size

How can I do that?

  1. make configurations blocks with any name and change compile to the name.
@im182cm
im182cm / facebooksdk.md
Last active May 28, 2021 02:11
While using CustomTabActivity in Facebook SDK, app or service are separated

While using CustomTabActivity in Android Facebook SDK, app or service are separated

Facebook SDK version : 4.28(includes before version which contains CustomTab)

This is what I found while investigating Facebook SDK.
If you have more than one app communicate each other, you can experience this.
There are defence codes in Facebook SDK, so it would not make a problem.

Summary

Set taskAffinity with a package name which holds the task.

<activity
@im182cm
im182cm / gist:ea9b9ac2fb45d1e74d452acf51903042
Last active December 7, 2017 00:57
Facebook SDK requestCode

Facebook SDK requestCode

In Facebook SDK Guide, there are no comments about requestCode. However sometimes I needed to set requestCode on onActivityResult to distinguish with other action and prevent wrong behavior.

Summary

CallbackManagerImpl.RequestCodeOffset.XXX.toRequestCode()

Set enum value instead of XXX. Enum values are below.
Example : CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode()

public enum RequestCodeOffset {
 Login(0),
@im182cm
im182cm / gist:2c7723d42b2d7091af6c493b97b732b7
Last active February 22, 2024 15:35
How to close CustomTab

How to close CustomTab

When using CustomTab, it has no close method. To close CustomTab, should use Braodcast and call the activity which opened CustomTab again.

Good Example from Facebook SDK

I have fixed some of codes for essential behavior.

gradle setting

Add a library below.

dependencies {