Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Updated readme to include troubleshooting info #47

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

joshzarrabi
Copy link
Contributor

More code for the phone, added two new classes, not really sure how to implement them with the cordova but thats all thats remaining I think...

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@shankari
Copy link
Contributor

shankari commented Jun 5, 2015

Two high level comments:

  1. this is not using cordova! I see from your top level comment that you still need to figure that out. I would suggest looking at that first. Lack of support for cordova is a non-starter.
  2. are you sure that it works offline - it seems to be an online sync mechanism at this point, when you wrap the URL into a "service client". A quick test for offline access/true background sync - turn off wifi on your laptop and then see if the screen still works in the emulator.
  3. recall prof. culler's comment:

The real lesson is that even if you build for one, you try to create an abstraction layer so you have a little shim and as narrow an exposure as possible. Then the possibility of retargeting or multi-target is not so bad. Tends to focus the mind on what is needed, rather than what is provided. And yes, failure to do this in the meteor space doomed the result.

I am not sure that is happening right now - this is really Azure specific. That is not surprising, since you are only implementing Azure at this point. But it would be awesome to build this in right now as we go along.

Let me put in a concrete goal. You are going to implement 3 options, right? Can we select between the three in the settings UI? Having that as a concrete goal will help ensure that we build a proper abstraction layer, rather than tying it together really tightly.

@joshzarrabi
Copy link
Contributor Author

Hi!

  1. In order for this to be native I'm almost 100% sure it needs to be in
    java, the Cordova can call it.
  2. Offline stuff comes later in the tutorial.
  3. Yeah I will do that

Thanks for the feedback!

Josh

On Friday, June 5, 2015, shankari [email protected] wrote:

Two high level comments:

  1. this is not using cordova! I see from your top level comment that
    you still need to figure that out. I would suggest looking at that first.
    Lack of support for cordova is a non-starter.

  2. are you sure that it works offline - it seems to be an online sync
    mechanism at this point, when you wrap the URL into a "service client". A
    quick test for offline access/true background sync - turn off wifi on your
    laptop and then see if the screen still works in the emulator.

  3. recall prof. culler's comment:

    The real lesson is that even if you build for one, you try to create an
    abstraction layer so you have a little shim and as narrow an exposure as
    possible. Then the possibility of retargeting or multi-target is not so
    bad. Tends to focus the mind on what is needed, rather than what is
    provided. And yes, failure to do this in the meteor space doomed the result.

I am not sure that is happening right now - this is really Azure specific.
That is not surprising, since you are only implementing Azure at this
point. But it would be awesome to build this in right now as we go along.

Let me put in a concrete goal. You are going to implement 3 options,
right? Can we select between the three in the settings UI? Having that as a
concrete goal will help ensure that we build a proper abstraction layer,
rather than tying it together really tightly.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109269169
.

@shankari
Copy link
Contributor

shankari commented Jun 5, 2015

  1. Let me clarify further. We want to do the sync in native code, but then we want to read the synced data in cordova. How can cordova call it? Is there a cordova plugin? I would start with checking to see if there is a cordova plugin because if there isn't, it is a big downside for us and we can use that as a filter function. That's why I suggested adding "cordova support" as an entry into the comparison table.

@shankari
Copy link
Contributor

shankari commented Jun 5, 2015

it is a big downside for us and we can use that as a filter function

ie, we should only evaluate projects that have cordova support. ie.e, we should filter out projects that don't have cordova support, similar to the way we filtered out javascript-only solutions like meteor.

@joshzarrabi
Copy link
Contributor Author

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it today to
see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code, but
    then we want to read the synced data in cordova. How can cordova call it?
    Is there a cordova plugin? I would start with checking to see if there is a
    cordova plugin because if there isn't, it is a big downside for us and we
    can use that as a filter function. That's why I suggested adding "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120
.

@joshzarrabi
Copy link
Contributor Author

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the phone, then
we use a plug in from cordova to grab it from there when we want to load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi [email protected]
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code, but
    then we want to read the synced data in cordova. How can cordova call it?
    Is there a cordova plugin? I would start with checking to see if there is a
    cordova plugin because if there isn't, it is a big downside for us and we
    can use that as a filter function. That's why I suggested adding "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120
.

@shankari
Copy link
Contributor

shankari commented Jun 5, 2015

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js in the
Cordova code.

What does "we need to store the data" mean? Don't they already do that? If
we have to deal with storage read/write and scheduling the sync then there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected] wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the phone, then
we use a plug in from cordova to grab it from there when we want to load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code, but
    then we want to read the synced data in cordova. How can cordova call
    it?
    Is there a cordova plugin? I would start with checking to see if there
    is a
    cordova plugin because if there isn't, it is a big downside for us and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048
.

@joshzarrabi
Copy link
Contributor Author

Yeah, as I'm coding this I'm not sure what advantage we would really get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected] wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js in the
Cordova code.

What does "we need to store the data" mean? Don't they already do that? If
we have to deal with storage read/write and scheduling the sync then there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected] wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the phone,
then
we use a plug in from cordova to grab it from there when we want to load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code, but
    then we want to read the synced data in cordova. How can cordova call
    it?
    Is there a cordova plugin? I would start with checking to see if there
    is a
    cordova plugin because if there isn't, it is a big downside for us and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056
.

@joshzarrabi
Copy link
Contributor Author

I guess a good thing is that this helps us handle conflicts better ...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
    // Item not returned in the exception, retrieving it from the server
    try {
        serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();
} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;

}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi [email protected]
wrote:

Yeah, as I'm coding this I'm not sure what advantage we would really get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected] wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do that? If
we have to deal with storage read/write and scheduling the sync then there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected] wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the phone,
then
we use a plug in from cordova to grab it from there when we want to load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code, but
    then we want to read the synced data in cordova. How can cordova call
    it?
    Is there a cordova plugin? I would start with checking to see if
    there
    is a
    cordova plugin because if there isn't, it is a big downside for us
    and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056
.

@shankari
Copy link
Contributor

shankari commented Jun 5, 2015

It is not clear that this conflict resolution is the right thing to do,
specially since the user is entering information on the client; in other
words, the conflict resolution is convenient but wrong. Do they actually
schedule the true background synch? I think couchbase mobile may have
better support.
On Jun 5, 2015 4:24 PM, "Josh Zarrabi" [email protected] wrote:

I guess a good thing is that this helps us handle conflicts better ...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
// Item not returned in the exception, retrieving it from the server
try {
serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();
} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;
}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi <[email protected]

wrote:

Yeah, as I'm coding this I'm not sure what advantage we would really get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected]
wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do that?
If
we have to deal with storage read/write and scheduling the sync then
there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected]
wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the phone,
then
we use a plug in from cordova to grab it from there when we want to
load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected] wrote:

  1. Let me clarify further. We want to do the sync in native code,
    but
    then we want to read the synced data in cordova. How can cordova
    call
    it?
    Is there a cordova plugin? I would start with checking to see if
    there
    is a
    cordova plugin because if there isn't, it is a big downside for us
    and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109480272
.

@joshzarrabi
Copy link
Contributor Author

I think you might be right, we may have to use push notification.

In all honesty azure didnt provide that great of documentation for Android
either.

Oh well...

Hopefully couchbase will provide better support.

On Fri, Jun 5, 2015 at 4:36 PM, shankari [email protected] wrote:

It is not clear that this conflict resolution is the right thing to do,
specially since the user is entering information on the client; in other
words, the conflict resolution is convenient but wrong. Do they actually
schedule the true background synch? I think couchbase mobile may have
better support.

On Jun 5, 2015 4:24 PM, "Josh Zarrabi" [email protected] wrote:

I guess a good thing is that this helps us handle conflicts better ...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
// Item not returned in the exception, retrieving it from the server
try {
serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();
} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;
}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi <
[email protected]

wrote:

Yeah, as I'm coding this I'm not sure what advantage we would really
get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected]
wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js
in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do
that?
If
we have to deal with storage read/write and scheduling the sync then
there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected]
wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the
phone,
then
we use a plug in from cordova to grab it from there when we want to
load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected]
wrote:

  1. Let me clarify further. We want to do the sync in native code,
    but
    then we want to read the synced data in cordova. How can cordova
    call
    it?
    Is there a cordova plugin? I would start with checking to see if
    there
    is a
    cordova plugin because if there isn't, it is a big downside for
    us
    and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109480272

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109483095
.

@joshzarrabi
Copy link
Contributor Author

I think we would have to use push notifications to do what we want

On Fri, Jun 5, 2015 at 5:03 PM, Joshua N Zarrabi [email protected]
wrote:

I think you might be right, we may have to use push notification.

In all honesty azure didnt provide that great of documentation for Android
either.

Oh well...

Hopefully couchbase will provide better support.

On Fri, Jun 5, 2015 at 4:36 PM, shankari [email protected] wrote:

It is not clear that this conflict resolution is the right thing to do,
specially since the user is entering information on the client; in other
words, the conflict resolution is convenient but wrong. Do they actually
schedule the true background synch? I think couchbase mobile may have
better support.

On Jun 5, 2015 4:24 PM, "Josh Zarrabi" [email protected] wrote:

I guess a good thing is that this helps us handle conflicts better ...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
// Item not returned in the exception, retrieving it from the server
try {
serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();
} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;
}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi <
[email protected]

wrote:

Yeah, as I'm coding this I'm not sure what advantage we would really
get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected]
wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js
in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do
that?
If
we have to deal with storage read/write and scheduling the sync then
there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected]
wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the
phone,
then
we use a plug in from cordova to grab it from there when we want to
load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected]
wrote:

  1. Let me clarify further. We want to do the sync in native
    code,
    but
    then we want to read the synced data in cordova. How can cordova
    call
    it?
    Is there a cordova plugin? I would start with checking to see if
    there
    is a
    cordova plugin because if there isn't, it is a big downside for
    us
    and
    we
    can use that as a filter function. That's why I suggested adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109480272

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109483095
.

@shankari
Copy link
Contributor

shankari commented Jun 6, 2015

We don't actually use push notifications on android even for our solution.
I know it sounds cool but we don't use it.

What is their story for true background sync? Do they even support it, or
is it primarily oriented towards refreshing the UI display?
On Jun 5, 2015 5:04 PM, "Josh Zarrabi" [email protected] wrote:

I think you might be right, we may have to use push notification.

In all honesty azure didnt provide that great of documentation for Android
either.

Oh well...

Hopefully couchbase will provide better support.

On Fri, Jun 5, 2015 at 4:36 PM, shankari [email protected] wrote:

It is not clear that this conflict resolution is the right thing to do,
specially since the user is entering information on the client; in other
words, the conflict resolution is convenient but wrong. Do they actually
schedule the true background synch? I think couchbase mobile may have
better support.

On Jun 5, 2015 4:24 PM, "Josh Zarrabi" [email protected] wrote:

I guess a good thing is that this helps us handle conflicts better ...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
// Item not returned in the exception, retrieving it from the server
try {
serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();

} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;
}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi <
[email protected]

wrote:

Yeah, as I'm coding this I'm not sure what advantage we would really
get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better
it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari [email protected]
wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the www/dbHelper.js
in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do
that?
If
we have to deal with storage read/write and scheduling the sync then
there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" [email protected]
wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the
phone,
then
we use a plug in from cordova to grab it from there when we want
to
load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at
it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari [email protected]
wrote:

  1. Let me clarify further. We want to do the sync in native
    code,
    but
    then we want to read the synced data in cordova. How can
    cordova
    call
    it?
    Is there a cordova plugin? I would start with checking to see
    if
    there
    is a
    cordova plugin because if there isn't, it is a big downside for
    us
    and
    we
    can use that as a filter function. That's why I suggested
    adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109480272

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109483095

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109486444
.

@joshzarrabi
Copy link
Contributor Author

I'm have trouble figuring it out. It seems like it's only for the ui, as in
it only checks for updates when you change something on the phone.

I feel like it should offer what we want, but the many hours I've spent
searching have been fruitless

On Friday, June 5, 2015, shankari [email protected] wrote:

We don't actually use push notifications on android even for our solution.
I know it sounds cool but we don't use it.

What is their story for true background sync? Do they even support it, or
is it primarily oriented towards refreshing the UI display?
On Jun 5, 2015 5:04 PM, "Josh Zarrabi" <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

I think you might be right, we may have to use push notification.

In all honesty azure didnt provide that great of documentation for
Android
either.

Oh well...

Hopefully couchbase will provide better support.

On Fri, Jun 5, 2015 at 4:36 PM, shankari <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

It is not clear that this conflict resolution is the right thing to do,
specially since the user is entering information on the client; in
other
words, the conflict resolution is convenient but wrong. Do they
actually
schedule the true background synch? I think couchbase mobile may have
better support.

On Jun 5, 2015 4:24 PM, "Josh Zarrabi" <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

I guess a good thing is that this helps us handle conflicts better
...

if (ex != null) {
// A conflict was detected; let's force the server to "win"
// by discarding the client version of the item
// Other policies could be used, such as prompt the user for
// which version to maintain.
JsonObject serverItem = ex.getValue();

if (serverItem == null) {
// Item not returned in the exception, retrieving it from the server
try {
serverItem =

mClient.getTable(operation.getTableName()).lookUp(operation.getItemId()).get();

} catch (Exception e) {
throw new MobileServiceSyncHandlerException(e);
}
}

result = serverItem;
}

This is conveniently in the code

On Fri, Jun 5, 2015 at 4:08 PM, Joshua N Zarrabi <
[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');

wrote:

Yeah, as I'm coding this I'm not sure what advantage we would
really
get
using this solution...

especially if what we have already works.
Because it is basically just doing what we already have...

It would probably be more elegant, but I'm not sure how much better
it
would actually end up being.

On Fri, Jun 5, 2015 at 3:20 PM, shankari <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

FYI, that is exactly what my current solution does. Look at the
ModeClassificationHelper in the android code and the
www/dbHelper.js
in
the
Cordova code.

What does "we need to store the data" mean? Don't they already do
that?
If
we have to deal with storage read/write and scheduling the sync
then
there
is no huge advantage to a paid solution.

Shankari
On Jun 5, 2015 2:03 PM, "Josh Zarrabi" <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

Ok, So I think I know what to do..

We use the native code to store the data in a SQLlite db on the
phone,
then
we use a plug in from cordova to grab it from there when we want
to
load
the page

On Fri, Jun 5, 2015 at 12:09 PM, Joshua N Zarrabi <
[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

I saw something about inplementing it with Cordova ...

I didn't really look into it much but it's there. I'll look at
it
today
to see how to call it from Cordova

On Friday, June 5, 2015, shankari <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

  1. Let me clarify further. We want to do the sync in native
    code,
    but
    then we want to read the synced data in cordova. How can
    cordova
    call
    it?
    Is there a cordova plugin? I would start with checking to see
    if
    there
    is a
    cordova plugin because if there isn't, it is a big downside
    for
    us
    and
    we
    can use that as a filter function. That's why I suggested
    adding
    "cordova
    support" as an entry into the comparison table.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109400120

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109439048

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109460056

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109480272

.


Reply to this email directly or view it on GitHub
<

https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109483095

.


Reply to this email directly or view it on GitHub
<
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109486444

.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109488233
.

@shankari
Copy link
Contributor

shankari commented Jun 6, 2015

I think that you should budget a fixed amount of time to look at this (x hours total) and move on to evaluating a different solution after that point.

After all, some of the advantages of moving to a paid solution are supposed to be ease of use and superior documentation. If a motivated UC Berkeley student can't figure out how to do something in x hours, then it is not easy and not well documented. So document the things that you tried, and move on to something else.

Remember that we always have our own solution as backup.

@joshzarrabi
Copy link
Contributor Author

Okay!

Thanks Shankari!!

Josh

On Fri, Jun 5, 2015 at 6:40 PM, shankari [email protected] wrote:

I think that you should budget a fixed amount of time to look at this (x
hours total) and move on to evaluating a different solution after that
point.

After all, some of the advantages of moving to a paid solution are
supposed to be ease of use and superior documentation. If a motivated UC
Berkeley student can't figure out how to do something in x hours, then it
is not easy and not well documented. So document the things that you tried,
and move on to something else.

Remember that we always have our own solution as backup.


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-109496616
.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

try {
String chosenBackend = String.valueOf(parent.getItemAtPosition(pos).toString());
Log.d(TAG, "Chosen Backend is " + chosenBackend);
ChosenBackend = chosenBackend;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a valid solution because the activity can be killed at any time by the system to reduce memory pressure. You need to store this somewhere. SharedPreferences is a reasonable solution.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

e.printStackTrace();
}
}
if (syncSkip == true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume that the sanity checks need to be the first things in the sync.

@shankari
Copy link
Contributor

Great to see that this is working!

@joshzarrabi
Copy link
Contributor Author

Hi SHankari,

Thanks for the review ...
The code is still really rough and full of my random debugging and
experimenting ...

I'll have to clean it up after I get authentication working

On Thu, Jun 18, 2015 at 8:00 PM, shankari [email protected] wrote:

Great to see that this is working!


Reply to this email directly or view it on GitHub
https://github.com/e-mission/e-mission-phone/pull/47#issuecomment-113352102
.

@AmplabJenkins
Copy link

Build triggered.

@AmplabJenkins
Copy link

Build started.

@AmplabJenkins
Copy link

Build finished. Test FAILed.

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

Successfully merging this pull request may close these issues.

4 participants