Skip to content

Instantly share code, notes, and snippets.

View huewu's full-sized avatar

Chansuk Yang huewu

  • Google
  • South Korea
View GitHub Profile
@huewu
huewu / gist:ed8bf1485864e3ca1768740c740e19f6
Created April 17, 2019 07:24
Get a Widevine DEVICE UNIQUE ID by using MediaDrm API in Android (28+)
val WIDEVINE_UUID = UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L)
val wvDrm = try {
MediaDrm(WIDEVINE_UUID)
} catch (e: UnsupportedSchemeException) {
//WIDEVINE is not available
null
}
wvDrm!!.apply {
// CODELAB: 아래 코드를 추가하세요
// '오늘 행사' action intent has been matched
'input.todayevent': () => {
// Firestore 접근을 위해 Firestore 클라이언트를 가져옵니다.
var db = admin.firestore();
var eventName;
// events 컬렉션에 접근해 DOCUMENT_ID의 문서 참조를 가져옵니다.
var docRef = db.collection('events').doc(DOCUMENT_ID)
@huewu
huewu / RemoteConfigFetch.java
Created November 5, 2016 01:59
Firebase Workshop RemoteConfig 관련 코드 조각
//in SplashActivity.java
@Override
protected void onResume() {
super.onResume();
FirebaseRemoteConfig.getInstance().fetch(60)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
@huewu
huewu / MessageDataAdapter.java
Last active November 5, 2016 00:46
Firebase Workshop RealtimeDatabase 관련 코드 조각들
package com.gdgkr.firebaseworkshop;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@huewu
huewu / SessionManagement.java
Last active November 4, 2016 23:40
Firebase Workshop Signin 관련 코드 조각들
//in MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (FirebaseAuth.getInstance().getCurrentUser() != null) {
showMessageListFragment();
} else {
@huewu
huewu / CourseListRequestTask & Parsing JSON using Gson
Last active August 29, 2015 14:12
한국에서 진행중인 Udacity Mini Codelab 의 예제 코드입니다.
static class CourseListRequestTask extends AsyncTask<Void, Void, String> {
private static final String TAG = "CourseListRequestTask";
@Override
protected String doInBackground(Void... params) {
try {
URL url = new URL("https://www.udacity.com/public-api/v0/courses");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
package com.example.gdg_opensource_codelab_sample_1;
import android.os.AsyncTask;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
@huewu
huewu / Handle Click Event
Created March 29, 2013 14:57
YouTubePlayerActivity
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
PlaylistItem item = (PlaylistItem) mListView.getItemAtPosition(position);
String videoId = item.getSnippet().getResourceId().getVideoId();
Intent intent = new Intent(MainActivity.this, YouTubePlayerActivity.class);
intent.putExtra(YouTubePlayerActivity.EXTRA_VIDEO_ID, videoId);
@huewu
huewu / PlaylistItemAdapter
Created March 29, 2013 14:49
YoutTubePlayList Item Adapter using ImageLoader
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.api.services.youtube.model.PlaylistItem;
import com.google.api.services.youtube.model.PlaylistItemSnippet;