Synchronisation questions

Put your problem here if it does not fit any of the other categories.

Synchronisation questions

Postby Rick » Wed Apr 28, 2010 3:00 pm

I have some problems with and questions about synchronising my server database to the one on the phone.

I created a SyncAdapter which extends AbstractThreadedSyncAdapter. It has the method onPerformSync(...) in which you can put your code that will do the synchronication. This works, but I can't find what the interval is on which the method is called. Does anyone know the interval time?

Another challenge is updating the frontend activity. If the activity is open, I want to update it and make a sound. If it's not open I want to start it (and also make a sound).

My guess was to emit a broadcast intent in onPerformSync(...). But I can't get it working.

I put this in onPerformSync(...):

Intent Test = new Intent();
Test.addCategory("rick");
Test.setAction("rick.SESSION_UPDATE");
mContext.sendBroadcast(Test);
Log.d(TAG, "sending broadcast intent");

I see the log message every one in a while.

This is the code in my frontend activity:

private BroadcastReceiver receiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Log.d("a", "broadcast intent received");
}
};

protected void onResume() {
super.onResume();

// register as a BroadcastReceiver for Intent action from our Service
IntentFilter filter = new IntentFilter();
filter.addCategory("rick");
filter.addAction("rick.SESSION_UPDATE");
registerReceiver(receiver, new IntentFilter(filter));

}

And this in the frontend activity manifest under intent-filter:

<action android:name="rick.SESSION_UPDATE" />
<category android:name="rick" />

Can anyone point me in the right direction on this? Or does anyone know a better way to implement what I'm trying to accomplish?

Thanks!
Rick
Freshman
Freshman
 
Posts: 3
Joined: Wed Apr 28, 2010 2:19 pm

Top

Postby Rick » Wed Apr 28, 2010 3:21 pm

I fixed it. It was working all along, had my logcat output filters set wrong.

Still want to know the interval time for the synchronisation though. Also, does anyone know if this interval time can be changed?
Rick
Freshman
Freshman
 
Posts: 3
Joined: Wed Apr 28, 2010 2:19 pm

Postby Rick » Mon May 03, 2010 3:22 pm

Anyone, please?!
Rick
Freshman
Freshman
 
Posts: 3
Joined: Wed Apr 28, 2010 2:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests