自己的签名查看签名信息
应用包解析查看xxx.RSA中可以看到签名信息
/**
* SharePreferences
*/
SharedPreferences sp = this.getSharedPreferences("bn", Context.MODE_PRIVATE);
String lastLoginTime=sp.getString("time",null);
if (lastLoginTime == null) {
lastLoginTime = "用户你好,欢迎第一次登陆";
} else {
lastLoginTime = "用户您好,您上次登陆的时间为:" + lastLoginTime;
}
SharedPreferences.Editor editor = sp.edit();
editor.putString("time", new Date().toLocaleString());
editor.commit();
textView2.setText(lastLoginTime);
ContentProvider
public class SimpleActivity extends AppCompatActivity {
ContentResolver cr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple);
ButterKnife.bind(this);
cr = this.getContentResolver();//获取ContentResolver对象
Cursor cursor = cr.query(Uri.parse("content://com.android.contacts/contacts"),
null,
null,
null,
null
);
StringBuilder sb = new StringBuilder();
while (cursor.moveToNext()) {
//获取联系人姓名
String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
sb.append("contactId=").append(contactId).append(",name=").append(name);
//获取联系人手机号码
Cursor phnones = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + contactId,
null,
null
);
while (phnones.moveToNext()) {
String phone = phnones.getString(phnones.getColumnIndex("data1"));
sb.append(",phone=").append(phone);
}
}
Log.i(TAG, "onCreate: "+sb.toString());
cursor.close();
}
public static final String TAG = SimpleActivity.class.getSimpleName();
}
权限
<uses-permission android:name="android.permission.WRITE_CONTACTS"></uses-permission>
<uses-permission android:name="android.permission.READ_CONTACTS"/>