Skip to content

Instantly share code, notes, and snippets.

@huewu
huewu / gist:ed8bf1485864e3ca1768740c740e19f6
Created Apr 17, 2019
Get a Widevine DEVICE UNIQUE ID by using MediaDrm API in Android (28+)
View gist:ed8bf1485864e3ca1768740c740e19f6
val WIDEVINE_UUID = UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L)
val wvDrm = try {
MediaDrm(WIDEVINE_UUID)
} catch (e: UnsupportedSchemeException) {
//WIDEVINE is not available
null
}
wvDrm!!.apply {
View input.todayevent handler
// 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)
View YouTubeChannelClient.java
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 / RemoteConfigFetch.java
Created Nov 5, 2016
Firebase Workshop RemoteConfig 관련 코드 조각
View RemoteConfigFetch.java
//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 Nov 5, 2016
Firebase Workshop RealtimeDatabase 관련 코드 조각들
View MessageDataAdapter.java
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 Nov 4, 2016
Firebase Workshop Signin 관련 코드 조각들
View SessionManagement.java
//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 / Handle Click Event
Created Mar 29, 2013
YouTubePlayerActivity
View Handle Click Event
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 Mar 29, 2013
YoutTubePlayList Item Adapter using ImageLoader
View PlaylistItemAdapter
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;
@huewu
huewu / CourseListRequestTask & Parsing JSON using Gson
Last active Aug 29, 2015
한국에서 진행중인 Udacity Mini Codelab 의 예제 코드입니다.
View CourseListRequestTask & Parsing JSON using Gson
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();