2013.3.26 PendingIntent,sqlite数据库

1,PendingIntent,当满足某些条件时要执行某个动作,动作包括激活一个Activity,broadcast,Service,具体动作和数据在Intent中,PendingIntent已知用在通知,短信发送,Alarm中,PendingIntent保存当前应用的context,即使当前应用被killed掉,其他应用也有权限和能力执行操作。

 If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it.

唯一确定一个PendingIntent:same operation, same Intent action, data, categories, and components, and same flags

2,

通过context的openfileoutput() 
创建的文件:
data/data/<包名>/files/config.txt 

存放手机rom内存里面的.

//写文件

FileOutputStream fos = context.openFileOutput("config.txt", MODE_APPEND);
String s = "abner:clever/123";
fos.write(s.getBytes());
fos.flush();
fos.close();

//读文件

File file = new File("/data/data/cn.itcast.datasave/files/config.txt");


FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while((len = fis.read(buffer))!=-1){
bos.write(buffer, 0, len);
}
byte[] result = bos.toByteArray();
String content = new String(result);

3,shell下查看数据库

adb shell
cd data/data/packagename/datebases/
sqlite3 dbname

你可能感兴趣的:(2013.3.26 PendingIntent,sqlite数据库)