可能重复:
确定是否在root设备上运行
如何(以编程方式)确定Android设备是否:rooted运行软件或ROM的破解副本.
我的数据库中有一些敏感信息,我希望在手机被root用户时加密,即用户可以访问数据库.我怎么检测到?
我在许多Java代码表示法中看到,在我们调用另一个方法之后,这是一个例子.
Toast.makeText(text).setGravity(Gravity.TOP, 0, 0).setView(layout).show();
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,makeText
我们打电话回来setGravity
,到目前为止
我怎么能用我自己的课程做到这一点?我必须做一些特别的事吗?
这个问题在某种程度上与我想要在startActivityForResult中获得额外内容的问题有关,但现在我面临另一个挑战.
我已订阅接收ProximityAlerts,我已明确构建Intent以包含一些Extras.但是当我得到服务时,额外的东西不存在.
这里的答案是工作代码:
Intent intent = new Intent(this, PlacesProximityHandlerService.class);
intent.setAction("PlacesProximityHandlerService");
intent.putExtra("lat", objPlace.getLat());
intent.putExtra("lon", objPlace.getLon());
intent.putExtra("error_m", objPlace.getError()+ALERT_RANGE_IN_METERS);
PendingIntent sender=PendingIntent.getService(this, 0, intent, 0);
LocationUtils.addProximity(this, objPlace.getLat(), objPlace.getLon(),objPlace.getError()+ALERT_RANGE_IN_METERS, -1, sender);
Run Code Online (Sandbox Code Playgroud)
文档说param PendingIntent to be sent for each location update
private Cursor getContacts()
{
// Run query
Uri uri = ContactsContract.Contacts.CONTENT_URI;
String[] projection = new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME
};
String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" +
(mShowInvisible ? "0" : "1") + "'";
String[] selectionArgs = null;
String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
}
Run Code Online (Sandbox Code Playgroud)
什么COLLATE LOCALIZED ASC
代表什么?
我在后台完成了AsyncTask完成的任务.在某些时候,我需要发出一个完成某事的Toast.
我试过,但我失败了,因为
Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
我怎样才能做到这一点?
我们在下面有查询.使用LEFT OUTER连接需要9秒才能执行.将LEFT OUTER更改为LEFT INNER会将执行时间减少到2秒,并返回相同的行数.由于正在处理dbo.Accepts表中相同的行数,因此无论连接类型如何,为什么外部需要更长的时间?
SELECT CONVERT(varchar, a.ReadTime, 101) as ReadDate,
a.SubID,
a.PlantID,
a.Unit as UnitID,
a.SubAssembly,
m.Lot
FROM dbo.Accepts a WITH (NOLOCK)
LEFT OUTER Join dbo.Marker m WITH (NOLOCK) ON m.SubID = a.SubID
WHERE a.LastModifiedTime BETWEEN @LastModifiedTimeStart AND @LastModifiedTimeEnd
AND a.SubAssembly = '400'
Run Code Online (Sandbox Code Playgroud) 我有这个查询,它在MySQL中运行良好
SELECT ((ACOS(SIN(12.345 * PI() / 180) * SIN(lat * PI() / 180) +
COS(12.345 * PI() / 180) * COS(lat * PI() / 180) * COS((67.89 - lon) *
PI() / 180)) * 180 / PI()) * 60 * 1.1515 * 1.609344) AS distance, poi.*
FROM poi
WHERE lang='eng'
HAVING distance<='30'
Run Code Online (Sandbox Code Playgroud)
距离以公里为单位,输入为lat=12.345
和lon=67.89
SQLite是3,我无法在Android上运行自定义函数.我也没有acos()等......因为它不是标准SQLite的一部分.
如何在SQLite中进行上述查询?
我希望在我的任何活动可见时启动意图,否则我会将其作为通知提出,并由用户触发.
要做出决定,我需要知道我的任何活动是否最重要,我该怎么做?
我期待以最快和最正确的方式检查数据库中是否存在记录:
public boolean Exists(String _id) {
Cursor c=db.query(TABLENAME(), new String[] {"1"}, "_ID="+_id, null, null, null, null);
if (!c.equals(null))
return c.moveToFirst();
return false;
}
Run Code Online (Sandbox Code Playgroud)
你觉得它有什么问题吗?
如果我能检测是否我的应用程序是使用Android Market安装我想知道(它在市场上的下载列表,并获得更新检查),或者它不是?
这将是一个很好的点来检测,如果该应用程序已没有安装,因为这可能意味着它被偷走,并从SD卡安装.