今天我更新了android SDK API 23.
一旦我将项目更改为针对Android SDK API 23,我就开始在eclipse中收到关于Apache的客户端和AndroidHttpClient API 的错误.API 23中不再能够找到Apache库API,但仍然可以使用API 22及更低版本继续正常工作.
有人可以建议这些错误背后的问题是什么?
项目中还有一个错误
谢谢.
android android-compatibility androidhttpclient android-6.0-marshmallow
我需要实现256位AES加密,我参考了这个 - http://nelenkov.blogspot.jp/2015/06/keystore-redesign-in-android-m.html KeyGenerator看起来像这样.
KeyGenerator keyGenerator = KeyGenerator
.getInstance(KeyProperties.KEY_ALGORITHM_AES,"AndroidKeyStore");
KeyGenParameterSpec spec = new KeyGenParameterSpec.Builder(keyName,
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
.setUserAuthenticationValidityDurationSeconds(5 *11160)
.build();
keyGenerator.init(spec);
SecretKey key1 = keyGenerator.generateKey();
Run Code Online (Sandbox Code Playgroud)
当我从keystore导入密钥的编码值时,它返回null给我.
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
SecretKey key3 = (SecretKey) keyStore.getKey(keyName, null);
Log.d("Test MM",key3.getEncoded()+",");
Run Code Online (Sandbox Code Playgroud)
我在logcat中找到了key3.getEncoded()的null值.请给我一些建议.
昨天我设置了目标并将sdk编译为23 API级别.当我使用预览Android M(MPA441)在Nexus 9上启动应用程序时,应用程序崩溃并出现以下SecurityException:
FATAL EXCEPTION: main
Process: com.grouplogic.mobilecho, PID: 22554
java.lang.RuntimeException: Unable to create application com.mypackage.MyApplication: java.lang.SecurityException: getDeviceId: Neither user 10098 nor current process has android.permission.READ_PHONE_STATE.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.SecurityException: getDeviceId: Neither user 10098 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceId(ITelephony.java:4175)
at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:706)
at com.mypackage.utils.DeviceUtils.isRunOnEmulator(DeviceUtils.java:63)
at com.mypackage.utils.DeviceUtils.getDeviceID(DeviceUtils.java:49)
at com.mypackage.domain.service.SettingService.setupPreferences(SettingService.java:79)
at com.mypackage.app.BaseApplication.createSingletons(BaseApplication.java:84)
at com.mypackage.app.BaseApplication.onCreate(BaseApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) …Run Code Online (Sandbox Code Playgroud) android android-permissions android-developer-api android-6.0-marshmallow
我正在学习开发一个Android应用程序,以便在Google开发者论坛之后获取设备位置:@ http://developer.android.com/training/location/retrieve-current.html#last-known @ http://developer.android. COM /培训/位置/接收位置updates.html
该示例显示了如何将Google PLay服务用于此目的.但该getLastLocation()函数始终返回null.
位置location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
最初位置可能为null,我添加了以下行以接收定期位置更新
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,mLocationRequest,this);
使用以下消息抛出异常
客户端必须具有ACCESS_COARSE_LOCATION或ACCESS_FINE_LOCATION权限才能执行任何位置操作
我已经在清单文件中添加了权限:
Run Code Online (Sandbox Code Playgroud)<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
我已经打开Google地图以更新Google Play服务中的当前位置,但同样的问题仍然存在.我是Android开发的新手,在发布这个问题之前我已经搜索了很多但没有找到适合我的任何解决方案.我在Android Marshmallow设备上测试它,开发使用Android Studio 1.3.2
AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="newray.acpsa1">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
onCreate函数在Activity中
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); …Run Code Online (Sandbox Code Playgroud) android location google-play-services android-6.0-marshmallow
mac因为android 6 marshmallow,blutooth地址和wifi地址()被删除.
bluetooth.getAddress();
Run Code Online (Sandbox Code Playgroud)
我们如何从Android设备获取唯一号码,如蓝牙地址或wifi mac地址?
android mac-address android-bluetooth android-6.0-marshmallow
如果用户将设备拔出并静止一段时间,屏幕关闭,设备将进入打盹模式.
在打盹模式启动之前,设备需要多长时间保持空闲和静止?
等等:
系统会定期退出Doze一段时间,让应用程序完成其延期活动.在此维护窗口期间[...]随着时间的推移,系统会越来越频繁地安排维护窗口......
那么,维护窗口间隔及其增长率是多少?
这段代码工作似乎在android api 16 - 22中工作但在api 23中不起作用.我只是试图在其中显示一个带有选项的popupwindow并将背景调暗到popupwindow下面:
WindowPopUp windowPopUp =
new WindowPopUp(mContext, mPlaces.get(position), position, fromSearch);
windowPopUp.showAtLocation(v, Gravity.CENTER, 0, 0);
View parent = (View) windowPopUp.getContentView().getParent();
//dim the window in the background
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) parent.getLayoutParams();
p.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.4f;
wm.updateViewLayout(parent, p);
Run Code Online (Sandbox Code Playgroud)
运行此代码会导致错误:
03-18 21:55:19.674 8814-8814/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp, PID: 8814
java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.view.WindowManager$LayoutParams
at com.bemyapp.adapter.OuterPlaceAdapter$5.onLongClick(OuterPlaceAdapter.java:400)
at android.view.View.performLongClick(View.java:5237)
at android.view.View$CheckForLongPress.run(View.java:21121)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417) …Run Code Online (Sandbox Code Playgroud) android layoutparams android-popupwindow android-6.0-marshmallow
我需要手动为API级别23请求权限,并且出现对话框窗口并且应用程序进入后台.
这是我的代码:
@Override
public void onDialogDone(int dialog, boolean result) {
DialogFragment newFragment;
switch (dialog) {
case EULA_DIALOG:
if (result) {
boolean numberExists = _appRegistration.checkPhoneNumber();
if (!numberExists) {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.READ_PHONE_STATE},
MY_PERMISSIONS_PHONE_STATE_READ);
return;
} else {
//do some work
}
} else {
Intent intent = new Intent(...);
startActivity(intent);
finish();
}
break;....
}
}
Run Code Online (Sandbox Code Playgroud)
另外,在MainActivity中我覆盖了以下方法:
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case MY_PERMISSIONS_PHONE_STATE_READ: {
if (grantResults.length > 0
&& grantResults[0] == …Run Code Online (Sandbox Code Playgroud) 我的应用程序的目标是在Android 6上运行,根据我的理解,它不允许加载共享库.
有没有人遇到过这个问题并且能够成功解决它?
java.lang.UnsatisfiedLinkError:dlopen失败:/data/app/com.XXX.XXX-2/lib/arm/libiconv.so:有文本重定位
android shared-libraries unsatisfiedlinkerror android-6.0-marshmallow
关于Android Auto Backup,只有几个问题.我之前没有使用过这个,所以首先阅读文档! https://developer.android.com/guide/topics/data/autobackup.html#Files
然后我制作了一个示例应用,并设法添加到已在Google云端硬盘中备份的应用列表.
但是我仍然希望从中清除事物,因为它比文档更容易理解.
这几点我搞砸了.
恢复计划
设备可以从其自己的备份或祖先数据集还原.如果两个源的备份都可用,则设备会优先考虑自己的备份.如果用户未通过设备设置向导,则设备只能从其自己的备份进行恢复.
onRestoreFinished()?如果有20 MB的数据?这有什么好的例子吗?启用和禁用备份
<application ...
android:allowBackup="true">
</app>
Run Code Online (Sandbox Code Playgroud)
要禁用自动备份,请将android:allowBackup设置为false.当您的应用可以通过其他某种机制重新创建其状态或您的应用处理不应备份的敏感信息时,您可能希望禁用备份
这行是在Manifest中,因此在备份任务完成后,最好的方法是将其设置为false.让我们说注册已完成,这就是我要备份的全部内容.如何在运行时更新该标记值?
有没有办法通过删除现有备份重置25MB备份配额?
谢谢