آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

باز کردن recent calls و انتخاب یک شماره برای ارسال sms?

محمد مقصودی  11 سال پیش  11 سال پیش
+1 0

چه گونه می توانم با استفاده از یک کلیک لیسنر به Recent Calls برم و بعد از انتخاب یک شماره sms رو که درون app آماده شده است رو ارسال کنم؟

0 0
تا جایی که من اطلاع دارم این recent call ها رو نرم افزارها خودشون موقعی که به صورت پیش فرض مدیریت میکنن تماس ها رو لاگ میکنن شما نمیدونم خودم بعید میدونم بتونین بهشون دسترسی داشته باشید اینطوری. شاید هم راحت باشه ولی من تا جای که میدونم اینطوریه (11 سال پیش)
+2 0
این لینک ها رو بررسی کنید لینک http://stackoverflow.com/questions/6446580/android-get-call-history-of-contact لینک (11 سال پیش)
 برای این سوال 1 پاسخ وجود دارد.
پاسخ به سوال 
محمد مقصودی  11 سال پیش
+1 0

خیلی ممنون از راهنمایی های شما، اما مساله این هست که با لینک هایی که شما معرفی کردید می تونی اطلاعات Calllog.call رو توی اپ خودت از طریق Cursor درون لیست نمایش بدی. و این کار نیازی به رفتن به خود Calllog.call نیست. اما من می خوام دقیقا مثل کد پایین که برای Contact هست برم درون Calllog و یک آیتم رو Pick کنم. ولی مثل اینکه شدنی نیست!!!!

توضیح: کد اول برای رفتن به Contact و Pick کردن یک آیتم هست که به خوبی عمل می کنه. اما کد دوم برای Calllog.call هست که عمل نمی کنه.(آدرس کد ها : http://developer.android.com/training/basics/intents/result.html)

باز هم ممنون می شم اگه راهنمایی کنید.

 staticfinalint PICK_CONTACT_REQUEST =1;// The request code

.
.
.

privatevoid pickContact(){
Intent pickContactIntent =newIntent(Intent.ACTION_PICK,Uri.parse("content://contacts"));
pickContactIntent.setType(Phone.CONTENT_TYPE);// Show user only contacts w/ phone numbers
startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
}

دریافت اطلاعات و انجام عملیات رو نتیجه :

 @Override
protectedvoid onActivityResult(int requestCode,int resultCode,Intent data){
// Check which request it is that we're responding to
if(requestCode == PICK_CONTACT_REQUEST){
// Make sure the request was successful
if(resultCode == RESULT_OK){
// Get the URI that points to the selected contact
Uri contactUri = data.getData();
// We only need the NUMBER column, because there will be only one row in the result
String[] projection ={Phone.NUMBER};

// Perform the query on the contact to get the NUMBER column
// We don't need a selection or sort order (there's only one result for the given URI)
// CAUTION: The query() method should be called from a separate thread to avoid blocking
// your app's UI thread. (For simplicity of the sample, this code doesn't do that.)
// Consider using CursorLoader to perform the query.
Cursor cursor = getContentResolver()
.query(contactUri, projection,null,null,null);
cursor.moveToFirst();

// Retrieve the phone number from the NUMBER column
int column = cursor.getColumnIndex(Phone.NUMBER);
String number = cursor.getString(column);

// Do something with the phone number...
}
}
}

 حالا کدی که برای Calllog.call نوشتم و عمل نمی کنه :

 staticfinalint PICK_CONTACT_REQUEST =1;// The request code

.
.
.

privatevoid pickContact(){
Intent pickContactIntent =newIntent(Intent.ACTION_PICK,Uri.parse("content://CallLog/Calls"));
pickContactIntent.setType(CallLog.Calls.CONTENT_TYPE);// Show user only contacts w/ phone numbers
startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
}

پردازش نتیجه :

 @Override
protectedvoid onActivityResult(int requestCode,int resultCode,Intent data){
// Check which request it is that we're responding to
if(requestCode == PICK_CONTACT_REQUEST){
// Make sure the request was successful
if(resultCode == RESULT_OK){
// Get the URI that points to the selected contact
Uri contactUri =CallLog.Calls.CONTENT_URI;
// We only need the NUMBER column, because there will be only one row in the result
String[] projection ={CallLog.Calls.NUMBER};

// Perform the query on the contact to get the NUMBER column
// We don't need a selection or sort order (there's only one result for the given URI)
// CAUTION: The query() method should be called from a separate thread to avoid blocking
// your app's UI thread. (For simplicity of the sample, this code doesn't do that.)
// Consider using CursorLoader to perform the query.
Cursor cursor = getContentResolver()
.query(contactUri, projection,null,null,null);
cursor.moveToFirst();

// Retrieve the phone number from the NUMBER column
int column = cursor.getColumnIndex(CallLog.Calls.NUMBER);
String number = cursor.getString(column);

// Do something with the phone number...
}
}
}

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .