标签: android-6.0-marshmallow

对多个用户使用来自Android的新指纹API

我们正在Android上创建一个时间戳应用程序,理想情况下,它将使用指纹来识别用户。

在一个组织中,可能有150个不同的用户。指纹API会允许多个用户吗?还是当前仅针对设备所有者?如果这仅适用于当前用户,是否有其他允许使用此功能的API?如果没有,我认为我们需要彻底放弃这条路。

fingerprint android-6.0-marshmallow

5
推荐指数
1
解决办法
5495
查看次数

由于OTA更新到Marshmallow,我的基于陀螺仪的应用程序不再起作用了

我用OTA将Nexus 5升级为Marshmallow.由于更新基于简单传感器的活动不再起作用.以下代码在其他设备上执行应该执行的操作(Galaxy S4 Lolipop,AVD,...)

有人也试过这个吗?我错过了什么吗?

这是代码:

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "fr.rouk1.test"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="fr.rouk1"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-feature
        android:name="android.hardware.sensor.gyroscope"
        android:required="true"/>
    <uses-feature
        android:name="android.hardware.sensor.accelerometer"
        android:required="true"/>
    <uses-feature
        android:name="android.hardware.sensor.compass"
        android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/> …
Run Code Online (Sandbox Code Playgroud)

android sensor android-6.0-marshmallow

5
推荐指数
1
解决办法
521
查看次数

Android studio getSlotFromBufferLocked:Marshmallow中的未知缓冲区错误

我试图用http://127.0.0.1/demo/调用webservices ,但它在Marshmallow中不起作用.它给出以下错误.我的webservices正在运行XAMPP服务器.

11-15 16:31:55.053 15702-15736/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xaefef440
Run Code Online (Sandbox Code Playgroud)

它在Lollipop和Kitkat中完美运行,

请指导我,谢谢!

xampp web-services localhost android-studio android-6.0-marshmallow

5
推荐指数
1
解决办法
2万
查看次数

Android 6.0的bug?有权限,但getScanResults()仍然在Android 6.0中返回空列表

我已经在Android版本6.0中请求了许可 - Marshmallow,但是当使用getScanResults()时它仍然返回空列表.

 private boolean checkPermission() {

    List<String> permissionsList = new ArrayList<String>();

    if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        permissionsList.add(Manifest.permission.ACCESS_FINE_LOCATION);
    }
    if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        permissionsList.add(Manifest.permission.ACCESS_COARSE_LOCATION);
    }

    if (permissionsList.size() > 0) {
        ActivityCompat.requestPermissions((Activity) mContext, permissionsList.toArray(new String[permissionsList.size()]),
                REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
        return false;
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

在请求权限之后,然后在onRequestPermissionsResult方法中,我获得了ACCESS_FINE_LOCATION和ACCESS_COARSE_LOCATION的权限,但我仍然无法扫描结果

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
                                       int[] grantResults) {
    switch (requestCode) {
        case REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS:
            if (permissions.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED ||
                    (permissions.length == 2 && grantResults[0] == PackageManager.PERMISSION_GRANTED &&
                            grantResults[1] == PackageManager.PERMISSION_GRANTED)){ …
Run Code Online (Sandbox Code Playgroud)

android android-6.0-marshmallow

5
推荐指数
1
解决办法
6992
查看次数

Android打盹模式 - 蓝牙

我的问题很简单.我想知道我的应用程序的最佳做法是什么,以便它可以"防止打瞌睡".随着Android N将在更多情况下应用Doze,这变得更加相关.

在阅读Doze文档时,有一部分提到了网络访问:

在打盹模式下,系统会通过限制应用程序访问网络和CPU密集型服务来尝试节省电池电量.它还可以防止应用程序访问网络并延迟其作业,同步和标准警报.

我相信Buetooth属于网络访问,这是正确的吗?

由于我没有使用Marshmallow(或Android N)设备,并且因为Emulator不允许蓝牙交互,所以我无法在打盹模式下测试我的应用行为.

Doze模式会杀死任何正在进行的蓝牙连接吗?这同样适用于Bluetooth Classic和LE吗?带蓝牙A2DP的耳机怎么样?

我的应用必须保持此连接,否则核心功能将被破坏.

当然,对于这样的情况,存在某种例外情况,即用户需要将设备连接到蓝牙远程设备.

我知道存在一个打盹白名单,但在某些情况下,似乎可能不会让应用程序在API 23以下的设备上运行.

谢谢您的帮助!

android bluetooth android-6.0-marshmallow android-doze android-7.0-nougat

5
推荐指数
1
解决办法
2216
查看次数

在Marshmallow中,如何像Hangouts一样逐个提示两个或多个权限对话框呢?

我正在处理我的应用程序代码以在Marshmallow设备中工作,我正在管理其权限对话框以显示在需要的位置.

目前在这种情况下,它需要两个权限(位置和存储),我想逐个询问Hangout的工作方式.无法找到它的定制方式,任何解决方案?

在此输入图像描述 在此输入图像描述

这是我为单一权限处理的代码:

case REQUEST_CODE_WRITE_EXTERNAL_STORAGE: {

    if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
        /Permission is granted
        Toast.makeText(this, "SDK >= 23 & permission Granted ", Toast.LENGTH_SHORT).show();
        return true;

    } else {
        //Permission is revoked
        ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CODE_WRITE_EXTERNAL_STORAGE);
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

并在onRequestPermissionsResult():

case REQUEST_CODE_WRITE_EXTERNAL_STORAGE: {

    // If request is cancelled, the result arrays are empty.
    if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

        // permission was granted, yay! Do the
        // contacts-related task you need …
Run Code Online (Sandbox Code Playgroud)

android android-permissions android-6.0-marshmallow

5
推荐指数
1
解决办法
835
查看次数

AlarmManager无法在Android 6.0上运行

我正在使用AlarmManager,它不适用于android os 6.0.这是我的代码:

 private void startAlarmManager(String id) {
    userID = GlobalValue.getUserName(GuideNavigationActivity.this);
    Context context = getBaseContext();
    alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    gpsTrackerIntent = new Intent(context, GpsTrackerAlarmReceiver.class);
    gpsTrackerIntent.putExtra("id", id);
    gpsTrackerIntent.putExtra("userID", userID);
    gpsTrackerIntent.putExtra("idCourse", idCourse.toString());
    gpsTrackerIntent.putExtra("typeCourse", typeCourse);
    pendingIntent = PendingIntent.getBroadcast(context, 0, gpsTrackerIntent, 0);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        alarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,System.currentTimeMillis()+ Constant.GPS_INTERVAL, pendingIntent);
    }
    else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,System.currentTimeMillis()+ Constant.GPS_INTERVAL, pendingIntent);
    } else {

        alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,System.currentTimeMillis()+ Constant.GPS_INTERVAL, pendingIntent);
    }
}
Run Code Online (Sandbox Code Playgroud)

请支持我 非常感谢.

android alarmmanager android-6.0-marshmallow

5
推荐指数
1
解决办法
803
查看次数

Android ID替代设备ID

我的应用程序始终使用DeviceId作为唯一标识符,这当然需要READ_PHONE_STATE作为权限。过去还可以,但是现在我已迁移到Marshmellow 23,在这里请求此权限会在运行时显示一个非常可怕的对话框,说...

“允许{我的应用}拨打和管理电话吗?”

对于只想获取deviceId的应用程序来说,这是一条非常可怕的消息。

我正在考虑切换到Android ID,因为它不需要任何许可。

String androidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
Run Code Online (Sandbox Code Playgroud)

谷歌搜索,我发现使用android ID时遇到了一些问题,但这都是陈旧的东西。在Froyo时代,有一家电话供应商为其所有电话生成相同的ID,但这就是我所看到的全部。

有人知道使用Android ID有任何问题吗?谢谢院长

android android-6.0-marshmallow runtime-permissions

5
推荐指数
1
解决办法
3792
查看次数

Android通知无法在Android 6.0(Marshmallow)上运行

我正在Android上实现本地通知,我遇到的问题是它们没有出现在Android 6.0(三星S7)上.我正在寻找解决方案,但我找不到任何解决这个问题的方法.我在正确的res/drawable文件夹中有图标,我也定义了通知标题,文本,铃声(原始文件夹)但它没有显示...有我的代码:

    Context acontext = getApplicationContext();

    PackageManager pm = acontext.getPackageManager();
    Intent notificationIntent = pm.getLaunchIntentForPackage(acontext.getPackageName());
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent pendingIntent = PendingIntent.getActivity(acontext, 0, notificationIntent, 0);
    int notification_icon = acontext.getResources().getIdentifier("icon", "drawable", acontext.getPackageName());
    int notificationID = 0;

    // Build notification
    Notification noti = new Notification.Builder(acontext)
            .setContentTitle("Title")
            .setContentText("Incoming text")
            .setSmallIcon(notification_icon)
            .setContentIntent(pendingIntent)
            .setLights(Color.RED, 1, 1)
            .build();
    NotificationManager notificationManager = (NotificationManager) acontext.getSystemService(Context.NOTIFICATION_SERVICE);
    // hide the notification after its selected
    noti.sound = Uri.parse("android.resource://" + acontext.getPackageName() + "/raw/incoming");
    noti.flags |= Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(notificationID, noti);
Run Code Online (Sandbox Code Playgroud)

有没有其他人遇到过这个问题?任何帮助,将不胜感激.谢谢.

notifications android android-notifications android-6.0-marshmallow

5
推荐指数
1
解决办法
1万
查看次数

打瞌睡,棉花糖和牛轧糖之间有所不同

目前我在关于Android 7.0的官方谷歌doc新闻中阅读
我无法理解一些事情.当用户屏蔽屏幕时,他们写了Doze通过关闭网络和CPU来改善电池寿命.但这是如何工作的?

1.我的设备中有Marshmallow,当我的手机被阻止时,我仍然会收到来自网络应用程序的通知(例如Messenger).

他们写Nougat的第二件事再次通过CPU和网络改进了这一点.那么什么是不同的?

android android-6.0-marshmallow android-7.0-nougat

5
推荐指数
1
解决办法
530
查看次数