使用adb shell清除应用程序数据
adb shell pm clear com.android.browser
Run Code Online (Sandbox Code Playgroud)
但是从应用程序执行该命令时
String deleteCmd = "pm clear com.android.browser";
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(deleteCmd);
} catch (IOException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
问题:
虽然我已经给出了以下许可,但它不会清除用户数据也不会给出任何异常.
<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA"/>
Run Code Online (Sandbox Code Playgroud)
题:
如何使用adb shell清除应用程序数据?
如下我能够通过给定的pid和vid获得附加到32位win7OS机器的usb com端口名称,但是当在x64中运行时它会卡在以下行中:
comports.Add((string)rk6.GetValue("PortName"));
Run Code Online (Sandbox Code Playgroud)
这是我的代码
static List<string> ComPortNames(String VID, String PID)
{
String pattern = String.Format("^VID_{0}.PID_{1}", VID, PID);
Regex _rx = new Regex(pattern, RegexOptions.IgnoreCase);
List<string> comports = new List<string>();
RegistryKey rk1 = Registry.LocalMachine;
RegistryKey rk2 = rk1.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum");
foreach (String s3 in rk2.GetSubKeyNames())
{
RegistryKey rk3 = rk2.OpenSubKey(s3);
foreach (String s in rk3.GetSubKeyNames())
{
if (_rx.Match(s).Success)
{
RegistryKey rk4 = rk3.OpenSubKey(s);
foreach (String s2 in rk4.GetSubKeyNames())
{
RegistryKey rk5 = rk4.OpenSubKey(s2);
RegistryKey rk6 = rk5.OpenSubKey("Device Parameters");
comports.Add((string)rk6.GetValue("PortName"));
}
}
}
}
return …Run Code Online (Sandbox Code Playgroud) 转换占位符文本的问题 input type="text"
这是我的示例代码:
HTML:
<div id="google_translate_element" style="float:left; padding-left:15px"></div>
<!-- Need to translate this placeholder text -->
<form><input type="text" placeholder= "Enter your name" />
<input type="submit" value="Submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
javascipt的:
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ca,da,de,el,en,es,fr,it,ja,ko,nl,pl,pt,ru,sv,tl', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Run Code Online (Sandbox Code Playgroud)
CSS:
<style>
div#google_translate_element div.goog-te-gadget-simple{background-color:green;}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span{color:yellow}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span:hover{color:#ffffff}
</style>
Run Code Online (Sandbox Code Playgroud)
翻译的例子是在
的jsfiddle:
http://jsfiddle.net/ulak/zDUYL/
请提及使用谷歌翻译翻译占位符文本的任何其他方式
使用 js CryptoJS 进行加密并使用 python crypto.Cipher 解密时遇到问题
这是我在 js 中的实现,用加密消息附加 iv 并用 base64 编码
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script>
var message='Secreat Message to Encrypt';
var key = CryptoJS.enc.Hex.parse('824601be6c2941fabe7fe256d4d5a2b7');
var iv = CryptoJS.enc.Hex.parse('1011121314151617');
var encrypted = CryptoJS.AES.encrypt(message, key, { iv: iv, mode: CryptoJS.mode.CBC });
encrypted =encrypted.toString();
encrypted = iv+encrypted;
encrypted = btoa(encrypted);
console.log('encrypted',encrypted );
alert(encrypted);
// var decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC });
// console.log('decrypted', decrypted);
//alert(decrypted.toString(CryptoJS.enc.Utf8));
</script>
Run Code Online (Sandbox Code Playgroud)
在用于 aes 加密和解密的 python 脚本中,我使用了
#!/usr/bin/python
import os, random, struct
from …Run Code Online (Sandbox Code Playgroud) 如何删除主屏幕中的快捷方式(以编程方式).我可以使用intent而不是其他现有的快捷方式删除我创建的快捷方式.
Bitmap theBitmap = ((BitmapDrawable)icon).getBitmap();
Intent shortcutIntent = new Intent();
shortcutIntent.setAction(Intent.ACTION_VIEW);
shortcutIntent.setClassName(url, group);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent removeIntent = new Intent();
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
removeIntent.putExtra("duplicate", false);
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, theBitmap);
removeIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
sendBroadcast(removeIntent);
Run Code Online (Sandbox Code Playgroud)
当使用如上所述的意图删除时,可以在知道图标包名+应用程序类名时删除快捷方式.我们可以使用PackageInfo获取所有应用程序的图标包名称,如下所示,但不是启动类名称
ArrayList<PInfo> res = new ArrayList<PInfo>();
List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);
if ((!getSysPackages) && (p.versionName == null)) {
continue ;
}
PInfo newInfo = new PInfo();
newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
newInfo.pname = p.packageName;
newInfo.classname = p.applicationInfo.className;
newInfo.versionCode = p.versionCode;
newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
Run Code Online (Sandbox Code Playgroud)
现在的问题是,有没有任何方法来获取应用程序的类名,然后我们可以删除在主屏幕中由此应用程序创建的快捷方式..任何帮助??
android ×2
javascript ×2
64-bit ×1
adb ×1
aes ×1
c# ×1
cryptography ×1
cryptojs ×1
homescreen ×1
html ×1
placeholder ×1
python ×1
shortcuts ×1
translation ×1
usb ×1
usbserial ×1
user-data ×1