In iOS, in the native Emoji keyboard, you can see your most recently used Emojis. I would like to know if it is possible to get the data on those Emojis (which is app-independent) from inside my app.
My goal is to display the most used emoji, given a user, in my app.
Tap the emoji button and look to see what your most frequently used emoji is. It's the one at the tippy-top of the list (unless you're using an Android device, which will show your most recently used emoji, not your most frequently used emoji).
In the Google Chat emoji picker, your most frequently used emojis can be found under the new βFrequently Usedβ section.
Emoji are ordered in 2 ways, under different priorities. The emoji that you use the most will always appear at the top. Emoji that you have recently used will appear after emoji that are used frequently. If this order is unexpected, and you want to provide feedback, Apple would love to gather your feedback!
If you just want an Emoji selector you could use/modify libraries like SYEmojiPopover or AGEmojiKeyboard which allows you to have full control on the output without messing with the iOS internals (albeit the "recents" list will be app-specific).
On iOS 9 the preferences are stored in the com.apple.EmojiPreferences
suite, which you could extract the list of most recently used emoji by:
// swift 3:
let prefs = UserDefaults(suiteName: "com.apple.EmojiPreferences")!
let defaults = prefs.dictionary(forKey: "EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]! as! [String: Any]
let recents = defaults["RecentsKey"]! as! [String]
print(recents)
// swift 2:
let prefs = NSUserDefaults(suiteName: "com.apple.EmojiPreferences")!
let recents = prefs.dictionaryForKey("EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]!["RecentsKey"]! as! [String]
print(recents)
// prints e.g. ["π", "π³", "πΏ", "β", "πΆ", "πΏπ¦", "βͺ", "π", "π
"]
Note that this is UNDOCUMENTED, and I have only checked it works on iOS 9 when deployed via Xcode. There is no guarantee that the App Store reviewers will allow this usage, nor there is any guarantee that it will work in the past or future versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With