Value of CallLog.Calls.TYPE field

On android,there are more than 3 values available for CallLog.Calls.TYPE field.
the following 3 are documented in android SDK so you can use it everywhere in your code:
CallLog.Calls.INCOMING_TYPE(1), CallLog.Calls.OUTGOING_TYPE(2), and CallLog.Calls.MISSING_TYPE(3)

But some vendor may extened this field,you may encounter following value on some device:
4 (VooiceMail), 5 (Rejected) and 6 (Refused List).

Let me know if there are more:)

PocketExport for android 3.2 is now available

Hi
Really glad to let you guys know that PocketExport for android 3.2 is available for testing now,
It takes me almost two month to finish it since last version,it’s a little bit long than my original plan.
In V3.2,PocketExport now support sync multiple device,each device’s data is synced to different outlook folder,
and i implemented a security code feature to make sure your personal data will not leaked to others.
Calendar sync only works for android after version 4.0,
Calendar sync is now still experimental and not enabled by default,you
can enable it by Settings–>Device Settings–>Enable “Sync Calendar” and choose the calendar account you want to sync with

Sync android calendar to outlook

Users of PocketExport for android keep asking me to add features to sync android calendar to outlook folder,
I think it’s a good idea to help user to sync their calendar items between android device and outlook.
So april this year i start to implement this function.
It’s turned out to be very difficult to implement this feature
Y can follow the steps below to have a general idea of how to sync canlednar items from android to outlook on PC
1.Retrieve calendar items from android
Notice that Android before Version 4.0 (Ice Cream Sandwich ) doesn’t have a public api to access calendar data
Finally i decieded to just support android after 4.0.So,if you are working with a android system before 4.0,
Y can skip this text at all!

Read calendar items from android is a little bit easier if compared with save it to outlook
below is the code :
final String sortOrder = "_id ASC";

String selection = "calendar_id=? and dtstart >= ?";
String[] selectionArgs = new String[] {calID,startDate};

Cursor cur = EAUtil.GetContentResolver().query(CalendarContract.Events.CONTENT_URI, null,
selection, selectionArgs, sortOrder);

if (cur == null) {
return null;
}

if (!cur.moveToFirst()) {
cur.close();
return null;
}

this will retrive the calendar items which after start date specified by startDate variable

2.Save calendar items retrieved at first step to outlook
Attention:nightmare begin.
I should admit i have underestimated the difficulty of save calendar items to outlook
Later on i will descriable this process by another 3 to 4 blogs,trust me,it not so easy than you can image
First of all,if you want to manage calendar items in outlook,i suggest read the following doc from MS:
[MS-OXOCAL].pdf,y can google to download it.
Y may also need to have very clear understanding of time format,something like UTC/day light saving time/timezone etc.

How to sync android through ADB?

Here adb is stand for android debug bridge.
If you want to connect your device to PC through USB cable(for sync or what ever other purpose),
Please follow the steps below

  • Enable USB debug on your android device:
  1. On most devices running Android 3.2 or older, you can find the option under Settings >Applications > Development.
  2. On Android 4.0 and newer, it’s in Settings > Developer options.
  3. On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
  • Install usb driver for your device

recenttly one of PocketExport’s user asked me why his samsung S3 mini can not sync with outlook(actually it can not connect to ADB on PC),
finally i found out that is because he doesn’t installed the USB driver for the phone.
Notice that by “USB driver” i mean driver for android device,not the driver for USB port.
For samsung android device,you can download it’s android phone’s driver from samsung’s website

  • Make sure there is no other Apps use adb at the same time

It seems that ADB can only support one connection a time(correct me if i am wrong),so if there are more than one app connect to your device at same time,only one of them can establish connection

Read MMS from android

What is MMS
MMS is stand for Multimedia Messaging Service
In android,MMS is stored at content://mms,
You can get the MMS list by the following code:

final String[] projection = new String[] { "*" };
Uri uri = Uri.parse("content://mms");

String selection = "date >= ?";
String[] selectionArgs = new String[] { sStartDate };

Cursor cur = contentResolver.query(uri, projection, selection, selectionArgs, null);

Text and images are stored at different place:”content://mms/part/@ID”,
where id is the id of MMS which retrieved from the first step

You can get the text of an android MMS by the following code:

Uri partURI = Uri.parse("content://mms/part/" + id);
InputStream is = null;
StringBuilder sb = new StringBuilder();

is = ContentResolver.openInputStream(partURI);
if (is != null) {
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
BufferedReader reader = new BufferedReader(isr);
String temp = reader.readLine();
while (temp != null) {
sb.append(temp);
temp = reader.readLine();
}
}

To get an image from MMS,the code is a little bit different:
Uri partURI = Uri.parse("content://mms/part/" + _id);
InputStream is = null;
Bitmap bitmap = null;
try {
is = EAUtil.GetContentResolver().openInputStream(partURI);
bitmap = BitmapFactory.decodeStream(is);
} catch (IOException e) {
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
}

Once you have read the data from a MMS,you can do what you want then,good luck:)

Various kinds of Time

If you have cross platform programing experience,you maybe feel confused among different kind of “time”
In VC++ (win32),FILETIME and SYSTEMTIME are both used to represent the time value.
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.
You can convert between them throug FileTimeToSystemTime/SystemTimeToFileTime function

In C#,there is a DateTime class used to manage time

In Java,Date class is used to manage the time

Android is the same as java i believe

Platform Struct/Class Start from Unit
VC: FILETIME/SYSTEMTIME from January 1, 1601 (UTC) 100-nanosecond
C# DateTime from January 1, 1601 (UTC) 100-nanosecond
Java(Android) Date UTC, January 1, 1970 milliseconds
Linux time_t UTC, January 1, 1970 second

Correct me if i am wrong,i will keep update this POST