TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ContextTELEPHONY_SERVICE);String imsi = mTelephonyMgrgetSubscriberId();String imei = mTelephonyMgrgetDeviceId();Logi("IMSI", imsi);Logi("IMEI", imei);
android如何获取联络人所有资讯 获取联络人必须新增许可权
<uses-permission android:name="androidpermissionREAD_CONTACTS" />
如何获取手机联络人资讯
根据ContactsContractContactsCONTENT_URI查询ContentResolver里面的资料,逐个取值即可。
如何获取sim卡的联络人资讯
根据目前查询的资讯来看,sim联络人的uri有两种:
content:i/adn
content:sim/adn
挨个去取即可。
如何获取联络人所有栏位
package ihopemozyhomeutil;import javautilArrayList;import javautilList;import jsonJSONException;import jsonJSONObject;import androidcontentContext;import androiddatabaseCursor;import androidproviderContactsContractCommonDataKindsEmail;import androidproviderContactsContractCommonDataKindsEvent;import androidproviderContactsContractCommonDataKindsIm;import androidproviderContactsContractCommonDataKindsNickname;import androidproviderContactsContractCommonDataKindsNote;import androidproviderContactsContractCommonDataKindsOrganization;import androidproviderContactsContractCommonDataKindsPhone;import androidproviderContactsContractCommonDataKindsStructuredName;import androidproviderContactsContractCommonDataKindsStructuredPostal;import androidproviderContactsContractCommonDataKindsWebsite;import androidproviderContactsContractData;import androidutilLog;import ihopemozyhomedomainContacts;public class GetContactsInfo {private List<Contacts> list;private Context context;private JSONObject contactData;private JSONObject jsonObject;public GetContactsInfo(Context context) { thiscontext = context;}public String getContactInfo() throws JSONException { 获得通讯录资讯 ,URI是ContactsContractContactsCONTENT_URI list = new ArrayList<Contacts>(); contactData = new JSONObject(); String mimetype = ""; int oldrid = -1; int contactId = -1; Cursor cursor = contextgetContentResolver()query(DataCONTENT_URI,null, null, null, DataRAW_CONTACT_ID); int numm=0; while (cursormoveToNext()) { contactId = cursorgetInt(cursorgetColumnIndex(DataRAW_CONTACT_ID)); if (oldrid != contactId) { jsonObject = new JSONObject(); contactDataput("contact" + numm, jsonObject); numm++; oldrid = contactId; } 取得mimetype型别 mimetype = cursorgetString(cursorgetColumnIndex(DataMIMETYPE)); 获得通讯录中每个联络人的ID 获得通讯录中联络人的名字 if (StructuredNameCONTENT_ITEM_TYPEequals(mimetype)) { String display_name = cursorgetString(cursorgetColumnIndex(StructuredNameDISPLAY_NAME)); String prefix = cursorgetString(cursorgetColumnIndex(StructuredNamePREFIX)); jsonObjectput("prefix", prefix); String firstName = cursorgetString(cursorgetColumnIndex(StructuredNameFAMILY_NAME)); jsonObjectput("firstName", firstName); String middleName = cursorgetString(cursorgetColumnIndex(StructuredNameMIDDLE_NAME)); jsonObjectput("middleName", middleName); String lastname = cursorgetString(cursorgetColumnIndex(StructuredNameGIVEN_NAME)); jsonObjectput("lastname", lastname); String suffix = cursorgetString(cursorgetColumnIndex(StructuredNameSUFFIX)); jsonObjectput("suffix", suffix); String phoicFirstName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_FAMILY_NAME)); jsonObjectput("phoicFirstName", phoicFirstName); String phoicMiddleName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_MIDDLE_NAME)); jsonObjectput("phoicMiddleName", phoicMiddleName); String phoicLastName = cursorgetString(cursorgetColumnIndex(StructuredNamePHONETIC_GIVEN_NAME)); jsonObjectput("phoicLastName", phoicLastName); } 获取电话资讯 if (PhoneCONTENT_ITEM_TYPEequals(mimetype)) { 取出电话型别 int phoneType = cursorgetInt(cursorgetColumnIndex(PhoneTYPE)); 手机 if (phoneType == PhoneTYPE_MOBILE) { String mobile = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("mobile", mobile); } 住宅电话 if (phoneType == PhoneTYPE_HOME) { String homeNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("homeNum", homeNum); } 单位电话 if (phoneType == PhoneTYPE_WORK) { String jobNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobNum", jobNum); } 单位传真 if (phoneType == PhoneTYPE_FAX_WORK) { String workFax = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("workFax", workFax); } 住宅传真 if (phoneType == PhoneTYPE_FAX_HOME) { String homeFax = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("homeFax", homeFax); } 寻呼机 if (phoneType == PhoneTYPE_PAGER) { String pager = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("pager", pager); } 回拨号码 if (phoneType == PhoneTYPE_CALLBACK) { String quickNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("quickNum", quickNum); } 公司总机 if (phoneType == PhoneTYPE_COMPANY_MAIN) { String jobTel = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobTel", jobTel); } 车载电话 if (phoneType == PhoneTYPE_CAR) { String carNum = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("carNum", carNum); } ISDN if (phoneType == PhoneTYPE_ISDN) { String isdn = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("isdn", isdn); } 总机 if (phoneType == PhoneTYPE_MAIN) { String tel = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("tel", tel); } 无线装置 if (phoneType == PhoneTYPE_RADIO) { String wirelessDev = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("wirelessDev", wirelessDev); } 电报 if (phoneType == PhoneTYPE_TELEX) { String telegram = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("telegram", telegram); } TTY_TDD if (phoneType == PhoneTYPE_TTY_TDD) { String tty_tdd = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("tty_tdd", tty_tdd); } 单位手机 if (phoneType == PhoneTYPE_WORK_MOBILE) { String jobMobile = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobMobile", jobMobile); } 单位寻呼机 if (phoneType == PhoneTYPE_WORK_PAGER) { String jobPager = cursorgetString(cursorgetColumnIndex(PhoneNUMBER)); jsonObjectput("jobPager", jobPager); } 其他通讯地址 if (postalType == StructuredPostalTYPE_OTHER) { String otherStreet = cursorgetString(cursorgetColumnIndex(StructuredPostalSTREET)); jsonObjectput("otherStreet", otherStreet); String otherCity = cursorgetString(cursorgetColumnIndex(StructuredPostalCITY)); jsonObjectput("otherCity", otherCity); String otherBox = cursorgetString(cursorgetColumnIndex(StructuredPostalPOBOX)); jsonObjectput("otherBox", otherBox); String otherArea = cursorgetString(cursorgetColumnIndex(StructuredPostalNEIGHBORHOOD)); jsonObjectput("otherArea", otherArea); String otherState = cursorgetString(cursorgetColumnIndex(StructuredPostalREGION)); jsonObjectput("otherState", otherState); String otherZip = cursorgetString(cursorgetColumnIndex(StructuredPostalPOSTCODE)); jsonObjectput("otherZip", otherZip); String otherCountry = cursorgetString(cursorgetColumnIndex(StructuredPostalCOUNTRY)); jsonObjectput("otherCountry", otherCountry); } } } cursorclose(); Logi("contactData", contactDatatoString()); return contactDatatoString();}}
拍拍贷如何获取联络人
拍拍贷app 可以获取你的通讯录,新浪有借也一样
而且更加好用
它的话是利息按日计,随时还款。
而一般的网贷如借10000,按照目前不低的年化收益率10%来计算的话, 一个月利息是83左右。 计算公式你记一下 10000x10%=1000(这里得出的是一年的收益) 1000/12=83 (除以12个月,才得到你一个月的)
微锁屏获取联络人资讯有风险吗
国内的很多软体都申请了很多不需要的许可权,锁屏软体应该是不需要读取联络人资讯的,可以安装一些软体取消锁屏软体的读取联络人许可权。
android怎么获取联络人头像
必须先编辑成正方形,或你的联络人有自动减取功能,不然头像肯定变形!
手机常显示易信正在尝试获取联络人资讯
这应该是易信在读取你的联络人,以便获取已经用手机号码注册了易信的手机上的联络人,可以考虑解除安装易信(如果不经常用的话)其实很多软体都喜欢读取个人资讯。。
为什么百度HI新增联络人时总是正在获取联络人资讯
应该是网速慢,如果你确定你的网速正常,那有可能是百度系统出错了。
我也遇到过这种情况。
还有一种可能,就是你新增的联络人不存在,或名字输入错误。
什么软体可以汇出联络人所有资讯
360手机卫士、qq都提供了云端备份通讯录的功能。现在备份到云端伺服器上是最安全的,永远不会丢失,换手机前备份一下,新手机上就可以下载到。平日经常备份联络人资讯,安全可靠有保障。
android开发怎样获取通讯录联络人资讯
public class ContactsActivity extends ListActivity {
Context mContext = null;
/获取库Phon表字段/
private static final String[] PHONES_PROJECTION = new String[] {
PhoneDISPLAY_NAME, PhoneNUMBER, PhotoPHOTO_ID,PhoneCONTACT_ID };
/联络人显示名称/
private static final int PHONES_DISPLAY_NAME_INDEX = 0;
/电话号码/
private static final int PHONES_NUMBER_INDEX = 1;
/头像ID/
private static final int PHONES_PHOTO_ID_INDEX = 2;
/联络人的ID/
private static final int PHONES_CONTACT_ID_INDEX = 3;
/联络人名称/
private ArrayList<String> mContactsName = new ArrayList<String>();
/联络人头像/
private ArrayList<String> mContactsNumber = new ArrayList<String>();
/联络人头像/
private ArrayList<Bitmap> mContactsPhonto = new ArrayList<Bitmap>();
ListView mListView = null;
MyListAdapter myAdapter = null;
@Override
public void onCreate(Bundle savedInstanceState) {
mContext = this;
mListView = thisgetListView();
/得到手机通讯录联络人资讯/
getPhoneContacts();
myAdapter = new MyListAdapter(this);
setListAdapter(myAdapter);
mListViewsetOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<> adapterView, View view,
int position, long id) {
呼叫系统方法拨打电话
Intent dialIntent = new Intent(IntentACTION_CALL, Uri
parse("tel:" + mContactsNumberget(position)));
startActivity(dialIntent);
}
});
superonCreate(savedInstanceState);
}
/得到手机通讯录联络人资讯/
private void getPhoneContacts() {
ContentResolver resolver = mContextgetContentResolver();
获取手机联络人
Cursor phoneCursor = resolverquery(PhoneCONTENT_URI,PHONES_PROJECTION, null, null, null);
if (phoneCursor != null) {
while (phoneCursormoveToNext()) {
得到手机号码
String phoneNumber = phoneCursorgetString(PHONES_NUMBER_INDEX);
当手机号码为空的或者为空栏位 跳过当前回圈
if (TextUtilsisEmpty(phoneNumber))
continue;
得到联络人名称
String contactName = phoneCursorgetString(PHONES_DISPLAY_NAME_INDEX);
得到联络人ID
Long contactid = phoneCursorgetLong(PHONES_CONTACT_ID_INDEX);
得到联络人头像ID
Long photoid = phoneCursorgetLong(PHONES_PHOTO_ID_INDEX);
得到联络人头像Bitamp
Bitmap contactPhoto = null;
photoid 大于0 表示联络人有头像 如果没有给此人设定头像则给他一个预设的
if(photoid > 0 ) {
Uri uri =ContentUriswithAppendedId(ContactsContractContactsCONTENT_URI,contactid);
InputStream input = ContactsContractContactsopenContactPhotoInputStream(resolver, uri);
contactPhoto = BitmapFactorydecodeStream(input);
}else {
contactPhoto = BitmapFactorydecodeResource(getResources(), Rdrawablecontact_photo);
}
mContactsNameadd(contactName);
mContactsNumberadd(phoneNumber);
mContactsPhontoadd(contactPhoto);
}
phoneCursorclose();
}
}
/得到手机SIM卡联络人人资讯/
private void getSIMContacts() {
ContentResolver resolver = mContextgetContentResolver();
获取Sims卡联络人
Uri uri = Uriparse("content:i/adn");
Cursor phoneCursor = resolverquery(uri, PHONES_PROJECTION, null, null,
null);
if (phoneCursor != null) {
while (phoneCursormoveToNext()) {
得到手机号码
String phoneNumber = phoneCursorgetString(PHONES_NUMBER_INDEX);
当手机号码为空的或者为空栏位 跳过当前回圈
if (TextUtilsisEmpty(phoneNumber))
continue;
得到联络人名称
String contactName = phoneCursor
getString(PHONES_DISPLAY_NAME_INDEX);
Sim卡中没有联络人头像
mContactsNameadd(contactName);
mContactsNumberadd(phoneNumber);
}
phoneCursorclose();
}
}
class MyListAdapter extends BaseAdapter {
public MyListAdapter(Context context) {
mContext = context;
}
public int getCount() {
设定绘制数量
return mContactsNamesize();
}
@Override
public boolean areAllItemsEnabled() {
return false;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView iamge = null;
TextView title = null;
TextView text = null;
if (convertView == null) {
convertView = LayoutInflaterfrom(mContext)inflate(
Rlayoutcolorlist, null);
iamge = (ImageView) convertViewfindViewById(Ridcolor_image);
title = (TextView) convertViewfindViewById(Ridcolor_title);
text = (TextView) convertViewfindViewById(Ridcolor_text);
}
绘制联络人名称
titlesetText(mContactsNameget(position));
绘制联络人号码
textsetText(mContactsNumberget(position));
绘制联络人头像
iamgesetImageBitmap(mContactsPhontoget(position));
return convertView;
}
}
}
mac地址和手机型号没有关系,手机型号可以通过下面的代码获取
androidosBuildVERSIONRELEASE获取版本号
androidosBuildMODEL 获取手机型号
import cnteachcourseR;
/
Created by postmaster@teachcoursecn on 2016/5/5
/
public class PhoneNameActivity extends ActionBarActivity {
private static final String TAG = PhoneNameActivityclassgetSimpleName();
private EditText et;
public static void start(Context context) {
start(context, null);
}
public static void start(Context context, Intent extras) {
Intent intent = new Intent();
intentsetClass(context, PhoneNameActivityclass);
intentaddFlags(IntentFLAG_ACTIVITY_CLEAR_TOP
| IntentFLAG_ACTIVITY_SINGLE_TOP);
if (extras != null) {
intentputExtras(extras);
}
contextstartActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
superonCreate(savedInstanceState);
setContentView(Rlayoutactivity_phone_name);
et = (EditText) thisfindViewById(Ridmobile);
}
public void getTelClick(View view) {
String name = etgetText()toString()trim();
number(name);
}
/
通过输入获取电话号码
/
public void number(String name) {
//使用ContentResolver查找联系人数据
Cursor cursor = getContentResolver()query(ContactsContractContactsCONTENT_URI, null, null, null, null);
//遍历查询结果,找到所需号码
while (cursormoveToNext()) {
//获取联系人ID
String contactId = cursorgetString(cursorgetColumnIndex(ContactsContractContacts_ID));
//获取联系人的名字
String contactName = cursorgetString(cursorgetColumnIndex(ContactsContractCommonDataKindsPhoneDISPLAY_NAME));
if (nameequals(contactName)) {
//使用ContentResolver查找联系人的电话号码
Cursor phone = getContentResolver()query(ContactsContractCommonDataKindsPhoneCONTENT_URI, null, ContactsContractCommonDataKindsPhoneCONTACT_ID + " = " + contactId, null, null);
if (phonemoveToNext()) {
String phoneNumber = phonegetString(phonegetColumnIndex(ContactsContractCommonDataKindsPhoneNUMBER));
ToastmakeText(this, phoneNumber+"TeachCourse——blog。。。", ToastLENGTH_SHORT)show();
Logd(TAG, "电话:" + phoneNumber);
break;
}
}
}
}
}
1、修改getTelClick()方法
2、修改Toast面包屑提示
3、修改获取联系人名字方法
4、位置稍微调整
以上就是关于如何获取android手机的IMEI全部的内容,包括:如何获取android手机的IMEI、android如何获取联络人所有资讯、android 怎么实现根据mac地址获取手机型号等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)