Confirmed users
355
edits
Nalexander (talk | contribs) No edit summary |
Nalexander (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
<h1> Native Sync </h1> | <h1> Native Sync </h1> | ||
== Setup == | |||
<p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a> | <p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a> | ||
</p> | </p> | ||
| Line 39: | Line 39: | ||
<p>After installation, fennec would crash on installation (unable to locate mozutils library, although it's in the apk). Possibly related to emulator failing to run NDK applications? | <p>After installation, fennec would crash on installation (unable to locate mozutils library, although it's in the apk). Possibly related to emulator failing to run NDK applications? | ||
</p> | </p> | ||
== Running everything == | |||
<p>The main <tt>android-sync</tt> source repository is hosted on github: | <p>The main <tt>android-sync</tt> source repository is hosted on github: | ||
</p> | </p> | ||
| Line 145: | Line 145: | ||
<ul><li> Select the <tt>test</tt> project and execute <tt>Run > Run As ... > Android JUnit Test</tt>. | <ul><li> Select the <tt>test</tt> project and execute <tt>Run > Run As ... > Android JUnit Test</tt>. | ||
</li></ul> | </li></ul> | ||
== Development == | |||
<p>Let's stick to some fairly sane Java conventions: 2-space indenting (Java is wide enough as it is), Maven2 for dependencies and build, JUnit4 for unit tests. We can wire in Hudson later if we have time. "Simple" for HTTP test server. | <p>Let's stick to some fairly sane Java conventions: 2-space indenting (Java is wide enough as it is), Maven2 for dependencies and build, JUnit4 for unit tests. We can wire in Hudson later if we have time. "Simple" for HTTP test server. | ||
</p><p>Let's figure out bleeding edge stuff ("how do I get a SyncAdapter to work?") in throwaway projects. There will be a lot of these :) | </p><p>Let's figure out bleeding edge stuff ("how do I get a SyncAdapter to work?") in throwaway projects. There will be a lot of these :) | ||
| Line 162: | Line 162: | ||
</p><p><span class="fck_mw_template">{{note|At this time, you can't see the current integration test code coverage.}}</span> | </p><p><span class="fck_mw_template">{{note|At this time, you can't see the current integration test code coverage.}}</span> | ||
</p> | </p> | ||
== Security == | |||
<p>Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials. | <p>Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials. | ||
</p><p><a href="http://developer.android.com/guide/topics/security/security.html">Android Docs on security </a> | </p><p><a href="http://developer.android.com/guide/topics/security/security.html">Android Docs on security </a> | ||
| Line 170: | Line 170: | ||
<blockquote><tt>android:sharedUserId</tt> | <blockquote><tt>android:sharedUserId</tt> | ||
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process</blockquote> | The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process</blockquote> | ||
== Permissions == | |||
<pre class="_fck_mw_lspace"> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | <pre class="_fck_mw_lspace"> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | ||
<uses-permission android:name="android.permission.MANAGE_CREDENTIALS" /> | <uses-permission android:name="android.permission.MANAGE_CREDENTIALS" /> | ||
| Line 183: | Line 183: | ||
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/> | <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/> | ||
</pre> | </pre> | ||
== Adjusting sync frequency == | |||
<p>If API > 8, use ContentResolver.addPeriodicSync() | <p>If API > 8, use ContentResolver.addPeriodicSync() | ||
</p><p>If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync(). | </p><p>If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync(). | ||
| Line 193: | Line 193: | ||
syncToNetwork set to true. | syncToNetwork set to true. | ||
</pre> | </pre> | ||
== Altering Sync settings == | |||
<pre class="_fck_mw_lspace"> android:syncAdapterSettingsAction defaults to null and if supplied it specifies an Intent action of an activity that can be used to adjust the sync adapter's sync settings. The activity must live in the same package as the sync adapter. | <pre class="_fck_mw_lspace"> android:syncAdapterSettingsAction defaults to null and if supplied it specifies an Intent action of an activity that can be used to adjust the sync adapter's sync settings. The activity must live in the same package as the sync adapter. | ||
</pre> | </pre> | ||
== Localization == | |||
<p>http://developer.android.com/guide/topics/resources/localization.html | <p>http://developer.android.com/guide/topics/resources/localization.html | ||
</p><p>Strings used in Firefox need to be localized into ALL THE LANGUAGES. Here's how to add a string. | </p><p>Strings used in Firefox need to be localized into ALL THE LANGUAGES. Here's how to add a string. | ||
| Line 204: | Line 204: | ||
</li><li> Run the preprocess script twice to generate the strings in strings.xml for use. These can be accessed using <b>@string/<string-name from strings.xml></b> when used in xml, or <b>R.strings.<string-name></b> in Java code. | </li><li> Run the preprocess script twice to generate the strings in strings.xml for use. These can be accessed using <b>@string/<string-name from strings.xml></b> when used in xml, or <b>R.strings.<string-name></b> in Java code. | ||
</li></ol> | </li></ol> | ||
== Schemas == | |||
<p>TODO | <p>TODO | ||
</p> | </p> | ||
== Gotchas == | |||
<p>Android's sqlite cursors are limited. Oh, and the heap is limited. We have to be very careful about how much data we store and process at one time. | <p>Android's sqlite cursors are limited. Oh, and the heap is limited. We have to be very careful about how much data we store and process at one time. | ||
</p> | </p> | ||
<blockquote cite="http://stackoverflow.com/questions/1407442/android-sqlite-and-huge-data-sets"><p>“You are out of heap space. With a 16MB non-compacting heap, and the fact that a Cursor holds the entire result set in the heap, that is not out of the question. CursorWindow only supports 1MB of data, which is what the error message suggests more directly.</p><p>If there is a logical way to divide your queries into discrete chunks, you could do incremental queries and use CursorJoiner to stitch them together, and see if that helps.”</p></blockquote> | <blockquote cite="http://stackoverflow.com/questions/1407442/android-sqlite-and-huge-data-sets"><p>“You are out of heap space. With a 16MB non-compacting heap, and the fact that a Cursor holds the entire result set in the heap, that is not out of the question. CursorWindow only supports 1MB of data, which is what the error message suggests more directly.</p><p>If there is a logical way to divide your queries into discrete chunks, you could do incremental queries and use CursorJoiner to stitch them together, and see if that helps.”</p></blockquote> | ||
== jvoll's notes == | |||
<p>Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047 | <p>Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047 | ||
</p><p>Lines to remove from mobile/android/base/AndroidManifest.xml.in if you don't feel like working around the permissions stuff: | </p><p>Lines to remove from mobile/android/base/AndroidManifest.xml.in if you don't feel like working around the permissions stuff: | ||
| Line 222: | Line 222: | ||
sqlite3 browser.db (or w/e database is wanted) | sqlite3 browser.db (or w/e database is wanted) | ||
</p> | </p> | ||
== Troubleshooting == | |||
<h3> "R cannot be resolved" </h3> | <h3> "R cannot be resolved" </h3> | ||
<p>Something is wrong with xml resolution. Check your Eclipse console errors in xml files, which will prevent Eclipse from building resource (R) files - resolve them first. | <p>Something is wrong with xml resolution. Check your Eclipse console errors in xml files, which will prevent Eclipse from building resource (R) files - resolve them first. | ||