Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

From version 4.1.0 on, the mySync client for Android includes a Content Provider which other apps can use to read some information about the user or the client. This page documents this feature. See developer.android.com for information about Content Providers.

Table of Contents

Profile information

Since: Client version 5.6; Server version 19.10

Content URI: content://{application ID}.provider/profile (for example: content://eu.mysync.android.dm.provider/profile)

Access to this data in protected. Calling package name must be listed in the ContentProviderPolicy of the device profile. Optionally also the package's signature fingerprint can be checked.

This content URI will provide a single row of information if the client has been provisioned. If access is denied, an unchecked exception is thrown. The client downloads updates to the data during scheduled connections.

Provider columns

Column name

Type

Description

deviceCnfdsf

deviceCn

String

Device's Common Name. This is the name visible in mySync user interfaces.

deviceId

String

Device's UUID.

orgCode

String

Organisation code

deviceMsisdn

String

Device's phone number as known by the server.

deviceDescription

String

Device profile's description as set on server.


User information

Content URI: content://{application ID}.provider/user (for example: content://eu.mysync.android.dm.provider/user)

The content URI contains the application ID which is different for different client variations.

This content URI will provide a single row of information if the client has been provisioned. Otherwise it will be empty.

Provider columns

Column name

Type

Description

accountId

String

User account ID

deviceId

String

User device ID. This is the name visible in mySync user interfaces, also known as CN or Common Name.

orgCode

String

Organisation code

serverUrl

String

Server URL

lastConnection

Long

Timestamp (in milliseconds) of last successful server connection

Example code

Example code
Code Block
languagejavatitleExample code
Context context = this;
ContentResolver cr = context.getContentResolver();
Uri uri = Uri.parse("content://eu.mysync.android.dm.provider/user");
String[] projection = {"accountId", "deviceId", "orgCode", "serverUrl", "lastConnection"};
Cursor cursor = cr.query(uri, projection, null, null, null);
String msg;
if (cursor != null) {
   if (cursor.moveToFirst()) {
      String accountId = cursor.getString(0);
      String deviceId = cursor.getString(1);
      String orgCode = cursor.getString(2);
      String serverUrl = cursor.getString(3);
      long lastConnection = cursor.getLong(4);
      msg = "mySync is provisioned. accountId: " + accountId + " deviceId: " + deviceId + " orgCode: " + orgCode + " server: " + serverUrl + " lastConnection: " + lastConnection;
   } else {
      msg = "mySync is not provisioned (no user information provided)";
   }
   cursor.close();
} else {
   msg = "mySync is not installed, mySync version does not support URI, or URI is wrong.";
}
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();

...