Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

My android application has a working mobilink synchronization, but is started only with a button click. I have to make my app synchronize in a period of time and I wonder what is the best approach to do this? Maybe a service with a running timer that calls the sync or it is better to try push notification.

asked 05 Apr '12, 11:54

katalun4o's gravatar image

accept rate: 85%

edited 05 Apr '12, 12:50

Graham%20Hurst's gravatar image

Graham Hurst

Thanks for the answers, I made it using AlarmManager, because the Timer has problems when the phone goes into sleep mode. The processor slows down and the timer doest'n execute as it is scheduled.

permanent link

answered 18 Apr '12, 10:31

katalun4o's gravatar image

accept rate: 85%

MobiLink has several options for Server Initiated Synchronization (SIS) and for Android you can also use Google C2DM to push synchronizations.

Unlike the SQL Anywhere client for MobiLink (dbmlsync), UltraLite has no built-in feature for scheduled synchronization but it does have support for performing background synchronization.

So changes on the consolidated database could start synchronization via SIS or C2DM, and you could have your Android application initiate a synchronization for changes made by it. Then there would be no need for scheduled synchronizations.

permanent link

answered 05 Apr '12, 12:43

Graham%20Hurst's gravatar image

Graham Hurst
accept rate: 29%

edited 05 Apr '12, 13:07

FYI, some documentation may suggest otherwise but SIS is supported for Android.

(05 Apr '12, 13:17) Graham Hurst

In addition to Graham's valid answer, if you do want to do scheduled synchronizations (for example to save the performance drain of doing synchronizations after many updates in a short time interval) there are several options. One thing I do not recommend is doing a potentially long-running operation like synchronization on the UI thread (such as a button click). A couple of options are: (1) you could use java.util.Timer to run scheduled synchronizations on a thread. (2) you could use android.os.AsyncTask to run synchronizations on a background thread.

permanent link

answered 12 Apr '12, 11:38

Andy%20Quick's gravatar image

Andy Quick
accept rate: 45%

Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Apr '12, 11:54

question was seen: 3,332 times

last updated: 18 Apr '12, 10:31