Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova / PhoneGap / Ionic Support #261

Open
timanglade opened this issue Feb 19, 2016 · 61 comments
Open

Cordova / PhoneGap / Ionic Support #261

timanglade opened this issue Feb 19, 2016 · 61 comments

Comments

@timanglade
Copy link
Contributor

No description provided.

@appden
Copy link
Contributor

appden commented Feb 25, 2016

I just rebased and pushed my older WIP branch, sk-cordova, which pretty much completes this task. 😄

@appden
Copy link
Contributor

appden commented Feb 25, 2016

I mean for iOS. For Android, this is pretty much blocked on #262 being done.

@keithdmoore
Copy link

👍 for Ionic support. Hopefully Ionic2!

@mlynch
Copy link

mlynch commented Jun 2, 2016

This would be awesome and well received in the Ionic community for sure. Curious why this wouldn't Just Work given the recent realm-js release?

@philliphartin
Copy link

@mlynch I would assume because for phonegap, an interface between the js library to the native hardware of the device would need to be developed to actually bring the benefit of realms speed. But then again, I have no idea.

@alazier
Copy link
Contributor

alazier commented Jun 3, 2016

The main issue with supporting phonegap/cordova at the moment is the need to support android. React Native runs on JavascriptCore on both iOS and android which is how we support both platforms. This is not the case for cordova/phonegap.

@caiobalthazar
Copy link

+1

@douglasjunior
Copy link

It's a good option to create a cordova-plugin to use realm-java and realm-cocoa?

As in https://github.com/mapsplugin/cordova-plugin-googlemaps

@PierBover
Copy link

The main issue with supporting phonegap/cordova at the moment is the need to support android

@alazier can you expand on that?

@alazier
Copy link
Contributor

alazier commented Sep 6, 2016

@PierBover - the way the Realm binding works is that we hook directly into the JS context for whatever environment we are supporting. React-native uses the same version of JavascriptCore on both ios and android which makes integration pretty straightforward. Cordovoa uses whatever the builtin JS interpreter is on the device it is running on, which makes things much more difficult. It might be possible to make things work by rolling a custom version of Cordova but this isn't something we have looked into. If you just want to support Cordova/iOS then it should be possible to get things working using the current codebase by getting the JSContext from a webview and passing it into the Realm initialization methods, but this is not something that we can currently support or maintain.

@PierBover
Copy link

Ok I see the problem.

Probably the best way to go for Cordova/Phonegap is making a native plugin (since you already have native iOS and Android libraries) with a JS wrapper API that mimics the one used in your React Native implementation.

@virtualprodigy
Copy link

My team really wants Realm for Cordova/Ionic. Any updates on if/when Cordova support would rollout?

@ghost
Copy link

ghost commented Nov 10, 2016

+1

@caiobalthazar
Copy link

I believe a plugin approach such as the one described by @PierBover would be the easiest way to do it.

@kitfactory
Copy link

+1

@faraazc
Copy link

faraazc commented Nov 24, 2016

+1 ionic2 support is really wanted in the community. This will open doors for PWA as well.

@AresDev
Copy link

AresDev commented Dec 5, 2016

+1

1 similar comment
@gozur
Copy link

gozur commented Dec 19, 2016

+1

@ghost
Copy link

ghost commented Dec 20, 2016

+1 IONIC2 support is wanted

@krasnokojiy
Copy link

+1

3 similar comments
@konrin
Copy link

konrin commented Dec 25, 2016

+1

@IvanAR
Copy link

IvanAR commented Jan 2, 2017

+1

@llearn
Copy link

llearn commented Jan 4, 2017

+1

@gkTim
Copy link

gkTim commented Jan 26, 2017

Any news on this?

@jruef
Copy link

jruef commented Feb 6, 2017

+1

@karapigeon
Copy link

As far as I know, this is not something that we are actively working on right now.

@zuhrulumam
Copy link

+1

@danmatthews
Copy link

danmatthews commented Feb 15, 2017

Damn, it's a shame that this isn't something that's actively being worked on - i think it's a big market potentially.

In the meantime, if you're not working on this, can someone close it and update it with some official news?

In the meantime guys - the best alternative is PouchDB with the sqlite adapter.

@dav021
Copy link

dav021 commented Jun 9, 2017

+1

1 similar comment
@yosuke1985
Copy link

+1

@ozexpert
Copy link

ozexpert commented Oct 9, 2017

What's the status? I've used React Native with Realm. But want to switch over using Ionic/Cordova with Realm. Blazingly fast database!!

@tryadelion
Copy link

What is the status again? it's been almost half a year since @kristiandupont 's statement. React native isn't the only cross platform JS framework, centering yourselves on it forces the rest of us to look elsewhere for worse solutions.

@syc-pad
Copy link

syc-pad commented Dec 18, 2017

+1

@tryadelion
Copy link

tryadelion commented Dec 19, 2017

Feature Request:

Goals

To achieve realm connection between a cordova-based hybrid app and the native library code by creating a cordova Typescript plugin that takes a generically Inputted syntax (RealmJS syntax?, swift syntax?) that redirects to the desired methods in the native code.

Examples of how this works:

https://github.com/arnesson/cordova-plugin-firebase

Expected Results

TS Plugin Usage:

import { RealmDB, RealmObject} from "Realm";
private car : RealmObject = {brand: "honda",subtype:"civic",codename:"grizzlybear",year:"2017",id: 12043};
constructor(realmInstance : RealmDB){
    realmInstance.open().subscribe( () => {
        realmInstance.write(car).subscribe( (res : Boolean) => {
          console.log(res);
        }
    });
}

TS BACKEND:

exports.open = function(success, error) { exec(success, error, "FirebasePlugin", "open"); };

Native IOS:

_let realm = try! Realm()

etc...

native Android:_
if (action.equals("open")) {
return realm.open( etc...
}
etc,,,,_

REASON

Realm.JS isn't made to be used as front end for webview-based hybrid apps, so there must be a way to use it. the easiest is to move the code "behind", and connect to the desired core when platform meets needs.

Possible compatible versions

Android
Ios
Windows 10 UWP (surface, desktop, windows phone All in One)

@bmunkholm
Copy link
Contributor

We currently don't have the spare capacity to take on more new platforms. There is a significant amount of work involved in creating, maintaining and providing support for each platform. So we would need the community to step up and assist with this effort. I can see that some effort is being put into https://github.com/airamrguez/cordova-plugin-realm.

@superandrew
Copy link

+1

@tryadelion
Copy link

tryadelion commented Jan 25, 2018

@bmunkholm hey brian, we understand that the capacity to make a new platform from scratch can be breathtaking. the issue with cordova-plugin-realm is that it relies on premade and predefined scheme files, built over json files.
I have no experience on React Native, but i suppose that what it does is detect concrete javascript method calls, and direct them to a native code that takes care of it. correct me if i'm wrong.
doing a Cordova wrapper that connected a Realm-JS'subset' of TS/JS calls with the already existant Realm-JS native (as in android/ios, not as in React) calls (and the already existing RealmJS syntax and boilerplate) could take some time to tinker, and a lot to test for a one man project (like any of us could do, or like cordova-plugin-realm is), but would be fast enough for multiple persons that do know how stuff works behind when doing it.

in the extreme end the community would be in charge of doing this kind of feature, we would appreciate a sample android studio module and ios pod (with their usage guides) with the Native side of the RealmJS calls, that we could later wrap it in a cordova module.
something like:
//run RealmStore.write( JsonObject object ) to open a write transaction, given a valid RealmJS schema object.syncronous method. returns a boolean if success or not.
//run RealmStore.defineSchema(JsonObject object,boolean update) to define a schema. if already exists, it will be ignored unless update is sent. syncronous method. returns a boolean if success or not.

@bmunkholm
Copy link
Contributor

@tryadelion As mentioned it's unfortunately not something that we can devote resources for at the moment. Depending on the help needed though, we would need to get some commitment from the community to this.
Perhaps @fealebenpae has input to how best to approach this.

@rethinkedu
Copy link

+1

1 similar comment
@kabus202
Copy link

kabus202 commented Feb 9, 2018

+1

@RoyGoode
Copy link

+1 for Ionic/Cordova

1 similar comment
@clariontools
Copy link

+1 for Ionic/Cordova

@faytekin
Copy link

+1 for Cordova Plugin

@taxilian
Copy link

Hi; I have need of realm in either Cordova or Capacitor and would potentially be interested in taking responsibility for the maintenance and/or sponsoring some additional help with it; however, after spending about 6 hours digging through code to understand how things are set up I can see a number of different approaches which could be taken to try to make it work and I don't want to waste a lot of time implementing something that is counter to the goals of the rest of the project.

Is there an IRC, Slack, Discord, etc room where I could discuss with other developers to get some questions answered and make sure I'm on the same page with others?

@kneth
Copy link
Member

kneth commented Feb 17, 2020

@taxilian It is a very generous offer, thank you. I can fully understand if digging through the source code hasn't help you much.

We don't have a public chat forum but we can probably set up Slack channel if needed.

@taxilian
Copy link

taxilian commented Feb 17, 2020 via email

@SergioSuarezDev
Copy link

How is going with Realm plugin for Ionic? :D

@muriloferes
Copy link

Realm for Ionic! Please!

@ryu-man
Copy link

ryu-man commented Aug 31, 2022

Is there any Idea how to use realm with ionic?

@saravanakumargn
Copy link

We should use realm-web?
https://www.mongodb.com/docs/realm/web/quickstart/

@taxilian
Copy link

taxilian commented Jan 11, 2023 via email

@takameyer
Copy link
Contributor

It might be possible to create a capacitor plugin that uses the realm-swift and realm-kotlin sdks. We don't have this on our radar at the moment, but it would be cool if someone in the community gave it a try.
Other than that, we are looking into a wasm based version of realm-web which would run a local database in a browser. I can't say if or when this will be completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests