获取报警信息来源和Android 4.0的改变它 [英] Get alarm infomation and changing it in android 4.0
问题描述
我尝试使用下面的检索内容提供商报警信息code
i am trying to retrieve alarm information from content provider using following code
final String tag_alarm = "tag_alarm";
Uri uri = Uri.parse("content://com.android.deskclock/alarm")
Cursor c = getContentResolver().query(uri, null, null, null, null);
Log.i(tag_alarm, "no of records are" + c.getCount());
Log.i(tag_alarm, "no of columns are" + c.getColumnCount());
if (c != null) {
String names[] = c.getColumnNames();
for (String temp : names) {
System.out.println(temp);
}
if (c.moveToFirst()) {
do {
for (int j = 0; j < c.getColumnCount(); j++) {
Log.i(tag_alarm, c.getColumnName(j);
+ " which has value " + c.getString(j));
}
} while (c.moveToNext());
}
}
这是给我的误差容许否认我复制好奇回答这个code从查询获取报警信息来源 在阮的评论,他指出一个解决方案,如果我嵌入此code在Android源$ C $ c和运行的图像文件,它可以通过权限被拒绝错误和检索报警信息。无论如何,感谢你的小费:)如何嵌入一个code在Android源$ C $ c和运行的图像文件?请解释一下我总是在Eclipse中创建一个项目,然后code和运行它运行application.please解释这一招
it is giving me error permission denial i copied this code from curious answer from query Get alarm infomation in the Nguyen's comment he pointed a solution "If i embed this code in Android source code and run image file, it can pass "permission denied" error and retrieve alarm information. Anyway, thanks your tip :) " how to embed a code in android source code and run image file ?? please explain i always create a project in eclipse and then code and run it as run application.please explain this trick
推荐答案
看在AndroidManifest.xml中的内容提供者的定义
Look at the definition of the content provider in AndroidManifest.xml
<provider android:name="AlarmProvider"
android:authorities="com.android.deskclock"
android:exported="false" />
导出的是假的,这意味着第三方应用程序不能访问它。许可拒绝作为一个结果。
The exported is false, which means a 3rd-party app cannot access it. Permission denial as a result.
如何嵌入一个code在Android源$ C $ c和运行图像文件
how to embed a code in android source code and run image file
这意味着你修改Android源(由谷歌提供)。我不认为这是你的情况是有用的。
It means you modify the Android source(Provided by google). I don't think it's useful in your case.
您可以做,在一个有根的设备,通过直接修改SQLite数据库的内容。我不认为这是一个解决方案,能在所有现有的Android平台。
You can do that in a rooted device, by directly modify the contents in sqlite database. I don't think there is a solution to work on all existing Android platforms.
在一般情况下,源码数据库文件是下 /数据/数据/应用程序包名/数据库/数据库的名称
,所以在这个例子中,它应该是/数据/数据/ com.android.deskclock /数据库/ com.android.deskclock或类似的东西。你可以拉文件由亚行拉
并使用SqliteExplorer来检查它是否是你想要的打开它。
In general, sqlite database files are under /data/data/app-package-name/databases/database-name
, so in this example, it should be /data/data/com.android.deskclock/databases/com.android.deskclock or something similar. You can pull the file out by adb pull
and open it using SqliteExplorer to check whether it is what you want.
有关如何修改该数据库文件,检查的使用的Android应用程序你自己的SQLite数据库
For how to modify this db file, check Using your own SQLite database in Android applications
这篇关于获取报警信息来源和Android 4.0的改变它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!