realm

Key Generation/Storage for react-native apps to encrypt realm db

本小妞迷上赌 提交于 2019-12-04 17:26:11
Does realm have any react-native support for key generation/key storage for encrypting the realm db? I wanted to check with the team working on realm before writing any native modules for the same. If there is any node module support for react native, that would be helpful. Thanks in advance. Realm does not provide any APIs for the generation or storage of encryption keys. I'm copying a comment I made in the past on this issue below just to provide my thoughts on some considerations that should be taken when dealing with encrypting Realms on React Native… The react-native-keychain module only

Fetch a single column from Realm Database (Android)

丶灬走出姿态 提交于 2019-12-04 16:48:40
I'm a beginner in Realm. I have a table with 3 columns which named Id, Name, Email,Address . To get the data of Name column, we use a query like 'SELECT Name from table_name' for SQLite. If we using Realm in Android, then which method do we have to use for fetching the data of only one column? I searched alot on Google & documentation but to no avail. Could anyone help me? Update: What I am tried: RealmResults<User> results = query.findAll(); ArrayList<String> name = new Arraylist(); for(i=0; i<results.size; i++){ name.add(result.get(i).getName(); } My problem: results.size() > 10k. So I want

Realm with Content Provider

我的梦境 提交于 2019-12-04 16:45:43
So, I've been used Realm for a while. For now, I have a task to share the login data with my other apps. Since the login data is stored using Realm. I choose to use Content Provider. I found an example: https://speakerdeck.com/androhi/realm-with-contentprovider Unfortunately, I was unable to make it work. This is my Content Provider in app A static final String[] sColumns = new String[]{ "LoginResultData" }; public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { Realm mRealm = Realm

Obtaining contacts from content provider without duplicates or invalid contacts, and save to Realm

自古美人都是妖i 提交于 2019-12-04 16:28:00
I have this code (thankfully provided by @EpicPandaForce) and I have problem with deletion. When I add new contact it works like a charm while when I delete contact (or number from that contact if there are two of them) it stays persisted in Realm. How can I get it working properly? realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { Contact realmContact = new Contact(); String filter = "" + ContactsContract.Contacts.HAS_PHONE_NUMBER + " > 0 and " + ContactsContract.CommonDataKinds.Phone.TYPE +"=" + ContactsContract.CommonDataKinds.Phone.TYPE_MAIN;

Using Realm with RxJava 2

一曲冷凌霜 提交于 2019-12-04 16:27:32
I am using RxJava 2 in my Android application, and am integrating Realm. As far as I can tell, Realm only supports RxJava 1 by default, and allows an Observable to be returned when querying for RealmResults<?> , like so: Realm.getDefaultInstance() .where(VideoBundle.class) .findAll() .asObservable() .first() The Observable returned is from RxJava 1. How can I use Realm and RxJava 2 together? I have come across 2 relevant issues, found here and here , but no succinct answer was found. Additionally, the documentation (found here: https://realm.io/docs/java/latest/#rxjava ) mentions creating a

Confusing about <security-role> in web.xml

倾然丶 夕夏残阳落幕 提交于 2019-12-04 15:14:17
问题 I'm understand that <security-role><role-name>Admin</role-name></security-role> is for container map it with tomcat-users.xml (realm) but I confuse about if I didn't use realm but I use database how container know which field in my database is for role-name or it have naming convention in database field name like "role_name" and container will know it Thank you for every advices 回答1: Just use a database realm and configure the table and column names in a <Realm> element in server

Calling .getEncoded() on SecretKey returns null

梦想的初衷 提交于 2019-12-04 14:52:55
I use the following code to generate an AES key: KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder("db_enc_key", KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT); KeyGenParameterSpec keySpec = builder .setKeySize(256) .setBlockModes("CBC") .setEncryptionPaddings("PKCS7Padding") .setRandomizedEncryptionRequired(true) .setUserAuthenticationRequired(true) .setUserAuthenticationValidityDurationSeconds(5 * 60) .build(); KeyGenerator keyGen = KeyGenerator.getInstance("AES", "AndroidKeyStore"); keyGen.init(keySpec); SecretKey sk = keyGen.generateKey(); but everytime

Cant add new object to RealmList due to null object reference

末鹿安然 提交于 2019-12-04 14:25:40
I have to realm objects, one is a basic RealmObject with a two strings and a boolean, the other is just a RealmList for that object for easier access. When I try to get the list from my instance of the ContactBook and add a new object I get the attempt to invoke virtual method on a null object reference. However Im able to get the size of the contactBook, and the amount of contacts so those are not null. Class Where I try to add new objects public void viewSetup() { setContentView(R.layout.activity_contacts); ButterKnife.inject(this); Realm.deleteRealmFile(this); realm = Realm.getInstance(this

How to insert items at 0 index to the Realm container

余生颓废 提交于 2019-12-04 14:17:25
Is there a way to insert new items at the 0 index to the Realm container? I don't see an insert method in the Realm class. Do I need to use List s? If the answer is yes, how can I restructure the following code to be able to use List s and keep the List in constant sync with the Realm container. In other words I'm having a hard time coming up with a good way to keep the Realm container and the List with the same items when adding and removing. In the following code new items are entered at the last index. How can I restructure it to be able to insert items at the 0 index? Model class import

RealmLog native Implementation not found

匆匆过客 提交于 2019-12-04 14:14:46
I am trying to use Realm Mobile Database, but i have some issues : I installed a Realm Object Server, and i try to create a use with an activity. Here my RegisterActivity public class RegisterActivity extends AppCompatActivity implements SyncUser.Callback { private AutoCompleteTextView usernameView; private EditText passwordView; private EditText passwordConfirmationView; private View progressView; private View registerFormView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); usernameView =