我遇到了 Android 6.0 的问题。Marshmallow 从官方 Nexus 工厂固件映像站点 ( https://developers.google.com/android/nexus/images )加载到 Nexus 6 。
我有一个应用程序,我使用 AlarmManager 启动一个禁用键盘保护的活动,因此即使手机被锁定(就像闹钟应用程序那样),该活动也可以看到。在此活动中,如果用户单击按钮,则会打开一个对话框,用户应在其中键入 EditText 视图。当对话框显示或用户单击 EditText 时,它应该打开键盘。这一直工作到现在,似乎在我的 Nexus 6 上除 6.0 之外的每个操作系统版本上都有效。
我怀疑原因是 Activity 启动时手机被锁定,就好像我在手机解锁时启动 Activity 然后键盘显示完美一样。这似乎只发生在 6.0 上。
任何人都可以确认这一点,或者让我知道 6.0 中是否发生了我不知道的变化?
谢谢。
更新 (Android 6) 我的 nexus 5 后,我正在运行的应用程序无法扫描(找到)任何蓝牙设备。getBondedDevices() 使配对设备列表正常工作。
我还测试了许多蓝牙功能的示例代码和应用程序(我在下面放了链接)。都是一样的问题,找不到蓝牙设备。
但是,是的,我在 Play 商店中只找到了一个正在运行的应用程序,它能够发现/扫描蓝牙设备。
无法在 Android 6 (Nexus 5) 上运行的应用程序我测试了许多应用程序,例如bluetrem、Android Developer 的示例代码等等。
工作应用 蓝牙 4.0 扫描仪 https://play.google.com/store/apps/details?id=com.bluemotionlabs.bluescan
有没有人知道是什么问题,是否需要对代码进行任何更改才能与 Android 6 兼容
android bluetooth nexus-5 network-scan android-6.0-marshmallow
我正在尝试实现 Android-6.0-marshmallow 中引入的指纹,但面临一个问题。
问题是当我尝试运行此处提供的示例代码时
它不止一次显示“尝试次数过多”错误。
要重现该问题,步骤是
1 - 单击购买按钮
2 - 提供错误的触摸 ID,直到出现“尝试次数过多”错误
3 - 提供密码
4 - 再次单击购买按钮。
现在它再次显示“尝试次数过多”错误并要求输入密码(这不是假设的行为)
请告诉我如何解决这个问题。
我有一个旧的 VoIP 应用程序,我想为其提供 Android 新的瞌睡和待机模式支持。我有自己的消息传递/信令机制,但无法使用 Android 的 GCM 功能。该文档指出,将应用程序列入白名单将允许使用自己的信号机制并使应用程序在打盹模式下保持活动状态。
此外,我正在使用setExtract()并setRepeating()当前保持 XMPP 的持久连接保持活动状态生成 keepAlive 警报。如果我添加setExactAndAllowWhileIdle新版本,它会声明 - 每 15 分钟最多触发一次警报。但我需要每 12 秒间隔生成 1 个。我浏览了 Android 文档,SO 中的许多线程,并找到了一篇关于它的文章。通过将应用程序列入白名单并使用AlarmManager的新 API ,我想要实现的目标似乎并不完全可行。
我能做些什么来保持我的功能和以前一样?在瞌睡和待机模式下保持应用程序活动,以 12 秒的间隔生成警报警报以保持连接活动并保持网络连接打开?
android alarmmanager android-6.0-marshmallow android-doze-and-standby
我的项目有 3 项不同的活动。第一个活动包含所有权限请求。应用程序已授予所有权限,但仍然无法在 SD 卡上写入文件。如果我关闭应用程序并再次启动,那么我可以在 SD 卡上写入文件。无论如何,是否有多个活动的更新权限。
public class PermissionActivity extends AppCompatActivity {
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;
private static int TIME_OUT = 2000;
private String TAG = "tag";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_permission);
Locale locale = new Locale("en");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
this.getResources().updateConfiguration(config, null);
if(checkAndRequestPermissions()) {
// carry on the normal flow, as the case of permissions granted.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This …Run Code Online (Sandbox Code Playgroud) 我定义我的应用程序链接如下AndroidManifest.xml:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="mysite.com" android:scheme="http"/>
<data android:host="mysite.com" android:scheme="https"/>
<data android:host="www.mysite.com" android:scheme="http"/>
<data android:host="www.mysite.com" android:scheme="https"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
该应用程序正确地检测到来自主机的 URL,但会提示用户是否要在应用程序或浏览器中打开它们,因为验证失败,如 Android 监控控制台所示:
01-17 15:44:28.847 7084-30015/? I/IntentFilterIntentSvc: Verifying IntentFilter. verificationId:2 scheme:"https" hosts:"mysite.com www.mysite.com" package:"com.site.myapp.android.flavor".
01-17 15:44:29.821 7084-30015/? I/IntentFilterIntentSvc: Verification 2 complete. Success:false. Failed hosts:mysite.com,www.mysite.com.
Run Code Online (Sandbox Code Playgroud)
我的 assetlinks.json 文件位于mysite.com/.well-known/assetlinks.json并包含正确的包名称和 SHA256 哈希值。它也可以通过 http 和 https 访问。我已经通过从 APK 中提取 CERT.RSA 文件并使用keytool -printcert -file CERT.RSA
我曾尝试调用https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://domain1:port&relation=delegate_permission/common.handle_all_urls以及使用谷歌站点语句列表测试器,并且都返回 OK。
我正在使用运行 Android 7 的 Nexus 设备进行测试。 …
我在 android 应用程序中遇到了一些本地化问题。
当我在api 级别 24及更高级别上测试时,更改语言的功能正常工作,但是当我在模拟器api 级别 23上更改语言时,它不会应用本地更改。我在很多论坛上都读到过这个,我几乎尝试了所有提供的解决方案,但它就是行不通。
重要的是,关闭弹出菜单的动画,即 listPreference,比 Android Nougat 上的关闭动画略显奇怪,所以它已经闻起来有些不规则。
重要说明是,我在 api 级别 23 或 Marshmallow 的物理设备上运行应用程序,但问题仍然存在。
在下面的部分中,我提供了一些对这种情况很重要的代码,另一方面,我省略了一些对于这种情况不需要的文件,例如strings.xml和preferences.xml。因此,这里的主要重点是实现更改应用程序语言的可能性。如果你们中有任何人有线索,我会请他与我们分享可能是什么问题。
用于设置 Locale 的 Helper 类
package com.metropolitan.hangouter;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import android.os.Build;
import java.util.Locale;
public class MyContextWrapper extends ContextWrapper {
public MyContextWrapper(Context base) {
super(base);
}
@SuppressWarnings("deprecation")
public static ContextWrapper wrap(Context context, String language) {
Configuration config = context.getResources().getConfiguration();
Locale sysLocale = null; …Run Code Online (Sandbox Code Playgroud) 我创建了一个带有OS(6.0)的Android模拟器,当模拟器启动时,我直接启动"浏览器"应用程序并崩溃.
这是一些日志:
W/System(1617): ClassLoader referenced unknown path: /system/app/webview/lib/arm
E/ActivityThread(1617): Failed to find provider info for com.google.settings
### WebView Version 44.0.2403.119 (code 246011900)
Fatal signal 6 (SIGABRT), code -6 in tid 1667 (GpuThread)
SELinux: Loaded file_contexts contexts from /file_contexts.
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk_phone_armv7/generic:6.0/MRA44C/2166767:eng/test-keys'
Revision: '0'
ABI: 'arm'
pid: 1617, tid: 1667, name: GpuThread >>> com.android.browser <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort …Run Code Online (Sandbox Code Playgroud) android android-emulator android-webview google-breakpad android-6.0-marshmallow
我有一个试图访问(TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);它的登录片段适用于Lollipop 5.1之前的设备.当我在Marshmallow 6.01中尝试它时,它显示了安全性异常.所以我从android docs添加了代码来请求运行时权限.这是代码
int permissionCheck = ContextCompat.checkSelfPermission(getActivity(),Manifest.permission.READ_SMS);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.READ_SMS)) {
// Show an expanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(getActivity(),new String[]{Manifest.permission.READ_SMS},REQUEST_SMS);
// REQUEST_SMS is an
// app-defined int constant. …Run Code Online (Sandbox Code Playgroud) android android-package-managers android-permissions packageinstaller android-6.0-marshmallow
我创建了一个程序,用于将文件上传到PHP服务器.它看起来像这样:
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private static final int PICK_FILE_REQUEST = 1;
private static final String TAG = MainActivity.class.getSimpleName();
private String selectedFilePath;
private String SERVER_URL = "http://192.168.0.29/aji/AndroidFileUpload/UploadToServer.php";
ImageView ivAttachment;
Button bUpload;
TextView tvFileName;
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ivAttachment = (ImageView) findViewById(R.id.ivAttachment);
bUpload = (Button) findViewById(R.id.b_upload);
tvFileName = (TextView) findViewById(R.id.tv_file_name);
ivAttachment.setOnClickListener(this);
bUpload.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v== ivAttachment){
//on attachment icon click
showFileChooser();
}
if(v== bUpload){
//on upload button …Run Code Online (Sandbox Code Playgroud) android ×10
alarmmanager ×1
applinks ×1
bluetooth ×1
deep-linking ×1
file-upload ×1
fingerprint ×1
json ×1
keyboard ×1
kotlin ×1
locale ×1
localization ×1
lockscreen ×1
network-scan ×1
nexus-5 ×1
permissions ×1