Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Realm Japan meetup Ueda
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
zaki50
November 12, 2016
Technology
710
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Realm Japan meetup Ueda
zaki50
November 12, 2016
More Decks by zaki50
See All by zaki50
I/O Extended 2018 @Tokyo Android1
zaki50
3
1.3k
簡単高速なDIライブラリToothpick
zaki50
1
240
Android Studio 3.0 profilerハンズオン
zaki50
2
810
Realm Japan meetup #23_Java
zaki50
0
770
Realm Japan meetup #22_Java
zaki50
1
590
Realm World Tour Osaka Recent Java Updates
zaki50
0
500
Realm World Tour - ErrorProne in Realm Java
zaki50
2
500
Realm World Tour Tokyo Recent Java Updates
zaki50
2
820
Realm World Tour - ErrorProne in Realm Java
zaki50
1
800
Other Decks in Technology
See All in Technology
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
850
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
290
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
210
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
2.1k
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.1k
Goodbye ShellScript, Hello File-based App
shunsock
0
160
銀行勘定系システムにおける開発プロセス刷新×AIによる環境モダナイゼーション / Development Process Transformation and AI-Driven Environment Modernization
muit
1
2.3k
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.1k
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
140
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
5
640
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
100
LLMに渡さなかった仕事
nanaism
0
690
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
460
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
400
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
エンジニアに許された特別な時間の終わり
watany
109
250k
Faster Mobile Websites
deanohume
310
32k
Transcript
Realm meetup ্ా
[email protected]
#realm_jp
[email protected]
Makoto Yamazaki Realm Inc. / uPhyca Inc.
[email protected]
What is Realm?
[email protected]
ٌغ؎ٕرغ؎أ㼔欽ח倜׃ֻ⡲ر٦ةك٦أ 0CKFDUJWF$䎃剢։ +BWB䎃剢։ 4XJGU䎃剢։ ٌغ؎ٕ欽鷿ח剑黝⻉ׁגְ 鹼䒀ٗ٦س
ئٗ؝ؾ٦ ط؎ذ؍ـ٥ؙٔٝ Realm
[email protected]
Realm ˖ ؙٗأفٓحزؿؓ٦ي ˖ J04"OESPJE ˖ +BWB 4XJGU 0CKFDUJWF$ $
+BWB4DSJQU ˖ ؔ٦فٝا٦أ ˖ 杝荈%#ؒٝآٝ42-JUF⢪גְזְ
[email protected]
Realmͷಛ 넝鸞ז⹛⡲ 农〾⻉垥彊鄲⪒ 湫䠬涸דءٝفٕז"1* ♨㻝ז؟ه٦ز傈劤铂0,
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ
[email protected]
class Article: Object { dynamic var id: Int = 0
dynamic var title: String = "" dynamic var contents: String = "" dynamic var creationDate: NSDate = NSDate() dynamic var modificationDate: NSDate = NSDate() dynamic var user: User? = nil let comments = List<Comment>() } Ϟσϧʢςʔϒϧʣఆٛ (iOS)
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ RealmObjectΫϥεΛܧঝ
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ ΧϥϜͱσʔλܕ
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ nullͷՄʗෆՄ
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ ̍ର̍ͷؔ࿈
[email protected]
public class Article extends RealmObject { @PrimaryKey private int id;
@Required private String title; private String contents; private Date creationDate; private Date modificationDate; private User user; private RealmList<Comment> comments; // getter, setter } Ϟσϧʢςʔϒϧʣఆٛ ̍ରଟͷؔ࿈
[email protected]
public final class RealmList<E extends RealmModel> extends java.util.AbstractList<E> implements io.realm.OrderedRealmCollection<E>
{ .... } Ϟσϧʢςʔϒϧʣఆٛ RealmListΫϥε
[email protected]
byte/Byte short/Short int/Integer long/Long boolean/Boolean float/Float double/Double String Date byte[]
モデルクラス RealmList<モデルクラス> Ϟσϧʢςʔϒϧʣఆٛ ΧϥϜʹ༻Ͱ͖Δܕ
[email protected]
Article article = new Article(); article.setId(1); article.setTitle("Realm meetup"); Realm
realm = Realm.getDefaultInstance(); try { realm.executeTransaction(realm -> { realm.insert(article); }); } finally { realm.close(); } σʔλͷอଘ
[email protected]
Article article = new Article(); article.setId(1); article.setTitle("Realm meetup"); Realm
realm = Realm.getDefaultInstance(); try { realm.executeTransaction(realm -> { realm.insert(person); }); } finally { realm.close(); } σʔλͷอଘ ϞσϧΦϒδΣΫτͷ࡞
[email protected]
Article article = new Article(); article.setId(1); article.setTitle("Realm meetup"); Realm
realm = Realm.getDefaultInstance(); try { realm.executeTransaction(realm -> { realm.insert(person); }); } finally { realm.close(); } σʔλͷอଘ RealmΠϯελϯεͷऔಘ
[email protected]
Article article = new Article(); article.setId(1); article.setTitle("Realm meetup"); Realm
realm = Realm.getDefaultInstance(); try { realm.executeTransaction(realm -> { realm.insert(person); }); } finally { realm.close(); } σʔλͷอଘ ςʔϒϧૠೖ
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = realm.where(Article.class)
.beginsWith("title", "Realm") .findAllSorted("creationDate", Sort.DESCENDING); } finally { realm.close(); } ΫΤϦ
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = realm.where(Article.class)
.beginsWith("title", "Realm") .findAllSorted("creationDate", Sort.DESCENDING); } finally { realm.close(); } ΫΤϦ RealmΠϯελϯεͷऔಘ
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = realm.where(Article.class)
.beginsWith("title", "Realm") .findAllSorted("creationDate", Sort.DESCENDING); } finally { realm.close(); } ΫΤϦ ݅ͷࢦఆͱ݁Ռͷऔಘ
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = realm.where(Article.class)
.equalTo("user.name", "Tim") .lessThan("user.age", 30) .findAllSorted("creationDate", Sort.DESCENDING); } finally { realm.close(); } ϦϯΫΫΤϦ
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = realm.where(Article.class)
.contains("comments.message", "Ueda") .contains("comments.message", "meetup") .findAllSorted("creationDate", Sort.DESCENDING); } finally { realm.close(); } ϦϯΫΫΤϦ ҙʂ
[email protected]
realm.where(Foo.class).equalTo(FooFields.AGE, 20); realm.where(Foo.class).equalTo("age", 20) http://bit.ly/RealmField realm.where(Foo::class.java).equalTo(Foo::age.name, 20); KotlinͷਓݩʑҎԼͷΑ͏ʹॻ͚ΔͷͰෆཁͰ͢ Realm Field
Names Helper
[email protected]
ΫΤϦϝιου isNull/isNotNull isEmpty/isNotEmpty equalTo/notEqualTo greaterThan greaterThanOrEqualTo lessThan lessThanOrEqualTo between contains
beginsWith endsWith in and or not beginGroup endGroup
[email protected]
ूܭϝιου sum average min max maximumDate minimumDate count
[email protected]
Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = ...;
Article article = articles.first(); article.isManaged(); // true Log.d("realm", article.getTitle()); Log.d("realm", article.getUser().getName()); Log.d("realm", article.getComments().get(0).getMessage()); } finally { realm.close(); } σʔλͷಡΈग़͠
[email protected]
RealmResults<Article> articles = ...; articles.addChangeListener(results -> { // ArticleΫϥεʹ͍ͭͯมߋɾՃɾআͷࡍʹݺΕΔ });
Article article = articles.first(); article.addChangeListener(obj -> { // ArticleΫϥεʹ͍ͭͯมߋɾՃɾআͷࡍʹݺΕΔ }); มߋ௨
[email protected]
࣮ࡍͷ͍ํ
[email protected]
࣮ࡍͷ͍ํ Activityฤ public class ArticleActivity extends AppCompatActivity { private Realm
realm; private Article article; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_article); int id = getIntent().getIntExtra("id", 0); realm = Realm.getDefaultInstance(); article = realm.where(Article.class).equalTo("id", id); } @Override public void onDestroy() { super.onDestroy(); realm.close(); } }
[email protected]
࣮ࡍͷ͍ํ Fragmentฤ public class ArticleFragment extends Fragment { private Realm
realm; private Article article; @Override public View onCreateView(...) { super.onCreateView(...); realm = Realm.getDefaultInstance(); int id = getIntent().getIntExtra("id", 0); article = realm.where(Article.class).equalTo("id", id); // Viewの作成 } @Override public void onDestroyView() { super.onDestroyView(); realm.close(); } }
[email protected]
࣮ࡍͷ͍ํ ඇLooperεϨουฤ public class MyThread extends Thread { @Override public
void run() { while(true) { // なんらかの処理 //結果を保存 Realm realm = Realm.getDefaultInstance(); try { realm.executeTransaction(realm -> { realm.insert(person); }); } finally { realm.close(); } } } }
[email protected]
࣮ࡍͷ͍ํ ඇLooperεϨουฤ public class MyThread extends Thread { @Override public
void run() { Realm realm = Realm.getDefaultInstance(); try { RealmResults<Article> articles = ...; while(true) { realm.waitForChange(); //articlesを読み出して必要な処理を実行 } } finally { realm.close(); } } }
[email protected]
public class MyApplication extends Application { @Override public void onCreate()
{ super.onCreate(); Realm.init(this); } } શମͷॳظԽ
[email protected]
ॏཁ֓೦
[email protected]
unmanaged/managed Article unmanagedArticle = new Article(); unmanagedArticle.isManaged(); // false unmanagedArticle.setTitle("meetup");
// OK RealmResults<Article> articles = ...; final Article managedArticle = articles.first(); managedArticle.isManaged(); // true managedArticle.setTitle("meetup"); // τϥϯβΫγϣϯΤϥʔ realm.executeTransaction(realm -> { managedArticle.setTitle("meetup"); // OK });
[email protected]
εϨουͷѻ͍ RealmΠϯελϯεͱ͔ͦ͜Βऔಘͨ͠ϥΠϒͳΦϒδΣΫτ εϨουؒͰͷड͚͠Λߦ͍͚ͬͯͳ͍ʂʂ
[email protected]
҉߸Խ
[email protected]
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); final RealmConfiguration config
= new RealmConfiguration.Builder() .encryptionKey(key) .build(); final Realm realm = Realm.getInstance(config); ҉߸Խ
[email protected]
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); final RealmConfiguration config
= new RealmConfiguration.Builder() .encryptionKey(key) .build(); final Realm realm = Realm.getInstance(config); ҉߸Խ 伴64όΠτ
[email protected]
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); final RealmConfiguration config
= new RealmConfiguration.Builder() .encryptionKey(key) .build(); final Realm realm = Realm.getInstance(config); ҉߸Խ 伴ͷੜͷҰྫ
[email protected]
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); final RealmConfiguration config
= new RealmConfiguration.Builder() .encryptionKey(key) .build(); final Realm realm = Realm.getInstance(config); ҉߸Խ 伴Ληοτͨ͠ઃఆใͷ࡞
[email protected]
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); final RealmConfiguration config
= new RealmConfiguration.Builder() .encryptionKey(key) .build(); final Realm realm = Realm.getInstance(config); ҉߸Խ RealmΠϯελϯεͷऔಘ
[email protected]
˖ إٝءذ؍ـז䞔㜠ך⥂㶷 խ⦐➂䞔㜠ծ،ؕؐٝزز٦ؙٝזו ˖ 衼⡲埄זוד⥂隊ׁر٦ة ҉߸Խ
[email protected]
Realm Mobile Platform
[email protected]
[email protected]
What is Realm Mobile Platform?
[email protected]
Realm Mobile Database ˖ 42-JUFך➿剏הזٌغ؎ٕرغ؎أ㼔欽ך ر٦ةك٦أ ˖ ؙٗأفٓحزؿؓ٦ي ˖ J04"OESPJE
˖ +BWB 4XJGU 0CKFDUJWF$ $ +BWB4DSJQU ˖ ؔ٦فٝا٦أ
[email protected]
Realm Mobile Platform
[email protected]
Realm Mobile Platform Realm Mobile Database
[email protected]
Realm Mobile Platform Realm Mobile Database Data Sync ٔ،ٕة؎يず劍
[email protected]
Realm Mobile Platform Realm Mobile Database Data Sync User Identify
ٔ،ٕة؎يず劍 ِ٦ؠ٦陎ⴽ
[email protected]
Realm Mobile Platform Realm Mobile Database Data Sync Access Control
User Identify ٔ،ٕة؎يず劍 ِ٦ؠ٦陎ⴽ ر٦ةⰟ剣
[email protected]
Realm Mobile Platform Realm Mobile Database Data Sync Access Control
User Identify Event Handling ٔ،ٕة؎يず劍 ِ٦ؠ٦陎ⴽ ر٦ةⰟ剣 ؽآطأٗآحؙ
[email protected]
Realm Mobile Platform Realm Mobile Database
[email protected]
Demo
[email protected]
ͬͯΈΔ
[email protected]
ηοτΞοϓ
[email protected]
Realm Object ServerΛىಈ͢Δ
[email protected]
AdminΞΧϯτΛ࡞Δ
[email protected]
ηοτΞοϓ
[email protected]
ηοτΞοϓ
[email protected]
μογϡϘʔυ
[email protected]
μογϡϘʔυ
[email protected]
Object Server্ͷσʔλΛݟΔ
[email protected]
Realm Browser
[email protected]
جຊతͳ͍ํ
[email protected]
ΞΫηετʔΫϯʢmacOSʣ
[email protected]
ΞΫηετʔΫϯʢCentOSʣ # cd /etc/realm/ # ls admin_token.base64 configuration.yml token- signature.key
token-signature.pub # cat admin_token.base64 ewoJImlkZW50a...
[email protected]
جຊతͳ͍ํ(Android) ηοτΞοϓ realm { syncEnabled = true } appͷbuild.gradeʹ
[email protected]
جຊతͳ͍ํ(Android) ೝূ Credentials creds = Credentials.usernamePassword(username, password, true); User.loginAsync(creds, "https://realm.example.com:9443/auth",
new User.Callback() { @Override public void onSuccess(User user) { // ログイン成功時の処理 } @Override public void onError(ObjectServerError error) { // エラー処理 } } );
[email protected]
جຊతͳ͍ํ(Android) RealmΠϯελϯεͷऔಘ // ユーザーとURLから設定を作成 SyncConfiguration config = new SyncConfiguration.Builder(user, "realm://realm.example.com/~/userRealm").build();
// 同期されるRealm Realm realm = Realm.getInstance(config);
[email protected]
جຊతͳ͍ํ(iOS) User.authenticate(with: Credential.usernamePassword(username: "username", password: "password", actions: []), server: URL(string:
"http://128.199.141.202:9080")!, onCompletion: { user, error in guard let user = user else { fatalError(String(describing: error)) } let configuration = Realm.Configuration( syncConfiguration: (user, URL(string: "realm://128.199.141.202:9080/~/realmtasks")!) ) self.realm = try! Realm(configuration: configuration) })
[email protected]
FacebookϩάΠϯ
[email protected]
FacebookϩάΠϯ facebookAuth = new FacebookAuth(loginButton) { @Override public void onRegistrationComplete(LoginResult
loginResult) { SyncCredentials credentials = SyncCredentials.facebook( loginResult.getAccessToken().getToken()); SyncUser.loginAsync(credentials, AUTH_URL, LoginActivity.this); } };
[email protected]
FacebookϩάΠϯ developers.facebook.com/docs/facebook-login/ android
[email protected]
Typical Application Data Flow Native object JSON Native object SQL
Native object JSON Native object SQLite/CoreData SQLite/CoreData
[email protected]
w/ Realm Mobile Platform
[email protected]
Data Sync ر٦ةず劍
[email protected]
User Identify ر٦ةず劍 ِ٦ؠ٦陎ⴽ
[email protected]
Access Control ر٦ةず劍 ِ٦ؠ٦陎ⴽ ،ؙإأ؝ٝزٗ٦ٕ
[email protected]
Event Handling ؎كٝزعٝسؚٔٝ
[email protected]
ΠϕϯτϋϯυϦϯά var Realm = require('realm'); var filter_callback = function(realm_name) {
... }; var change_notification_callback = function(realm_name, realm) { var channels = realm.objects('Channel'); for (var i = 0; i < channels.length; ++i) { var channel = channels[i]; ... } }; Realm.setGlobalSyncListener(local_root_dir, server_base_url, access_token, filter_callback, change_notification_callback);
[email protected]
[email protected]
Realm Mobile Platform ˖ .PCJMF%BUBCBTF ˖ 倯ぢךر٦ةず劍 ˖ ٔ،ٕة؎ي ˖
ء٦يٖأ ˖ ؝ٝؿؙٔزך荈⹛鍑寸 ˖ ِ٦ؠ٦陎ⴽ ˖ ؎كٝزعٝسؚٔٝ • αʔόʔϓογϡ • σʔλڞ༗ • ΞΫηείϯτϩʔϧ
[email protected]
ίϯϑϦΫτͷղܾ • جຊޙউͪ • ಉ͡ΞΠςϜʹผͷมߋΛՃ͑ͨ߹ɺޙʹىͬͨ͜มߋ͕࠾༻ ͞Ε·͢ɻ • ಉ͡ΠϯσοΫεͷૠೖ࣌ؒॱʹͳΔ • আͯ͢ʹউͭ
• ͋ΔΞΠςϜ͕আ͞ΕͯɺผͷσόΠεͰಉ͡ΞΠςϜΛมߋ ͨ͠ɺͱ͍͏߹ɺআ͚͕ͩى͜Γ·͢ɻ
[email protected]
Demo github.com/realm/RealmTasks
[email protected]
Recent Updates
[email protected]
Recent Updates • Realm Objective-C/Swift 2.0.3 • Realm Java 2.2.0
• Realm React Native 0.14.0 • Realm Xamarin 0.78
[email protected]
Where to find us • $ Realm Japan User Group:
facebook.com/groups/realmjp • $ Twitter: twitter.com/realmJapan • GitHub: github.com/realm • $ StackOverflow: ja.stackoverflow.com/questions/tagged/realm • $ Email:
[email protected]
• $ Slack: slack.realm.io/
[email protected]
Realm Japan User Group Facebook
[email protected]
Support Chat Slack http://slack.realm.io/
[email protected]
Ξϯέʔτ http://bit.ly/RealmJP_Ueda
[email protected]
Questions? Makoto Yamazaki
[email protected]
www.realm.io/jp @zaki50
[email protected]