All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE

All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE - Welcome to ANDROID KAWE, Ini adalah sebuah blog directory tentang burung,baik itu suara burung ataupun tips perawatan burung.Blog ini adalah situs perangkum otomatis dari pencarian google yang kali ini berjudul All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE.Ada ribuan artikel yang sudah terekam ke dalam situs ini,silahkan cari sesuai yang kalian kehendaki,untuk artikel selanjutnya tentang judul diatas bisa kalian baca di bawah ini.

Konten : All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE
Judul : All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE

lihat juga


All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE


Social Stream API in Contacts Provider


Android 4.0.3 API Level (15) is released for the developers with a new support for social streams in contact list. Now you can add the support to update and manage the social activities from facebook,twitter and other social networks and update the contacts data with simple APIs. 

This is really a good stuff added in Android to create good applications around the social networks. Here in this post we are highlighting the APIs you can use to create the new exciting apps with your social networks.

Now you could get the status updates, check-ins , activities and photo updates from social stream and associate this data with your contact list.

The database table for contacts now have two more Uris ContactsContract.StreamItems and ContactsContract.StreamItemPhotos.

In order to read and write the social streams you need to add two more permissions to your application manifest file.

<uses-permission android:name="android.permission.READ_SOCIAL_STREAM"> 
<uses-permission android:name="android.permission.WRITE_SOCIAL_STREAM">

Social stream updates are always associated with the raw contacts and can be insert,update,delete or retrieve.

You can use the content Uris to add the social stream with raw contact
 ContentValues values = new ContentValues();
 values.put(StreamItems.RAW_CONTACT_ID, rawContactId);
 values.put(StreamItems.TEXT, "Lunch at 3.00 PM");
 values.put(StreamItems.TIMESTAMP, timestamp);
 values.put(StreamItems.COMMENTS, "Family and Friends");
 Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
 builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
 builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
 Uri streamItemUri = getContentResolver().insert(builder.build(), values);
 long streamItemId = ContentUris.parseId(streamItemUri);

Now you can associate the photos with social updates
 values.clear();
 values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
 values.put(StreamItemPhotos.SORT_INDEX, 1);
 values.put(StreamItemPhotos.PHOTO, photoData);
 getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);

You can retrieve the social updates of the raw contact id as follows

 Cursor c = getContentResolver().query(Uri.withAppendedPath(
          ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
          RawContacts.StreamItems.CONTENT_DIRECTORY)),
          null, null, null, null);
 

Now get ready to build a quick App using the above APIs.

Please provide your valuable comments to improve this post.

Creative Android Apps



Demikianlah Artikel All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE

Semoga artikel tentang All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE, mudah-mudahan bisa memberi manfaat untuk anda semua.

Anda sedang membaca artikel All About Android-Get Social Updates of your contact list using Ice cream sandwich-ANDROIDKAWE dan artikel ini url permalinknya adalah http://androidkawe.blogspot.com/2016/10/all-about-android-get-social-updates-of.html Semoga artikel ini bisa bermanfaat.Sekali lagi,ini adalah situs auto yang tidak ditulis langsung oleh admin,Kami tidak menjamin akan kebenaran dari artikel yang tertulis.
Back To Top