学员投稿:华为,ov等手机主流大厂桌面未读计数角标更新接口汇总

Android桌面角标调研 主流手机厂商桌面角标的设置异同。 阅读详情

背景:

上一篇文章马哥有分享关于桌面角标应该如何设计的文章:
聊一聊android桌面的未读计数角标应该如何设计呢?
有一个学员朋友就积极联系马哥,说他原来做第三方应用的,有负责过app在各个手机桌面显示角标功能,对这个角标适配深感麻烦,也非常希望google官方可以完全统一这一块的桌面角标功能各个手机厂商各自为战的情况。
学员朋友也分享出来的了他以前适配各个手机厂商的桌面角标的相关详细接口调用,当时适配有10种手机的桌面角标功能。
下面学员朋友开始分享app适配各个手机厂商的桌面角标。

适配整体情况:

适配角标一般需要去各个厂商的官方文档中进行寻找,有的厂商还经常没有文档,这个时候可能就需要通过一些官方商务渠道或者论坛售后渠道等联系获取适配方案。不过最简单方法当然是去网上搜人家现成开源的,当时我们就有参考github上一个开源的角标适配库,用它就可以实现大部分主流手机桌面的角标功能。

接口设计讲解:

主要有以下2个接口方法:

void executeBadge
主要负责真正实现对角标的设置,也就是在这个方法中实现对手机厂商的角标设置

List getSupportLaunchers()
主要来实现提供出哪些桌面包名是可以支持角标的,因为有的厂商可能有一些桌面是不支持的。

主流厂商方案

其实主要的这些厂商普遍分为3个技术实现方向:

1.采用类似华为的方案,采用contentprovider,使用call接口调用传递app角标数据

2.采用Brocast广播方案,相关角标数据使用广播发送

3、小米方案特殊一些,采用通知相关接口,属于比较另类

下面列出一些主流手机的桌面角标接口实现(因为本人不做app好些年了,不确定下面接口是否已经更新变化)

华为

public class HuaweiHomeBadger extends Badger {

    private final Uri CONTENT_URI = Uri.parse("content://com.huawei.android.launcher.settings/badge/");

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        Bundle localBundle = new Bundle();
        localBundle.putString("package", context.getPackageName());
        localBundle.putString("class", componentName.getClassName());
        localBundle.putInt("badgenumber", badgeCount);
        context.getContentResolver().call(CONTENT_URI, "change_badge", null, localBundle);
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList("com.huawei.android.launcher");
    }

}

OPPO

public class OPPOHomeBader extends Badger {

    private static final String PROVIDER_CONTENT_URI = "content://com.android.badge/badge";
    private static final String INTENT_ACTION = "com.oppo.unsettledevent";
    private static final String INTENT_EXTRA_PACKAGENAME = "pakeageName";
    private static final String INTENT_EXTRA_BADGE_COUNT = "number";
    private static final String INTENT_EXTRA_BADGE_UPGRADENUMBER = "upgradeNumber";
    private static final String INTENT_EXTRA_BADGEUPGRADE_COUNT = "app_badge_count";
    private static int ROMVERSION = -1;

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        if (badgeCount == 0) {
            badgeCount = -1;
        }
        Intent intent = new Intent(INTENT_ACTION);
        intent.putExtra(INTENT_EXTRA_PACKAGENAME, componentName.getPackageName());
        intent.putExtra(INTENT_EXTRA_BADGE_COUNT, badgeCount);
        intent.putExtra(INTENT_EXTRA_BADGE_UPGRADENUMBER, badgeCount);
        if (canResolveBroadcast(context, intent)) {
            context.sendBroadcast(intent);
        } else {
            int version = getSupportVersion();
            if (version == 6) {
                try {
                    Bundle extras = new Bundle();
                    extras.putInt(INTENT_EXTRA_BADGEUPGRADE_COUNT, badgeCount);
                    context.getContentResolver().call(Uri.parse(PROVIDER_CONTENT_URI), "setAppBadgeCount", null, extras);
                } catch (Throwable th) {
                    throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString());
                }
            }
        }
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Collections.singletonList("com.oppo.launcher");
    }

    private int getSupportVersion() {
        int i = ROMVERSION;
        if (i >= 0) {
            return ROMVERSION;
        }

        try {
            i = ((Integer) executeClassLoad(getClass("com.color.os.ColorBuild"), "getColorOSVERSION", null, null)).intValue();
        } catch (Exception e) {
            i = 0;
        }

        if (i == 0) {
            try {
                String str = getSystemProperty("ro.build.version.opporom");
                if (str.startsWith("V1.4")) {
                    return 3;
                }
                if (str.startsWith("V2.0")) {
                    return 4;
                }
                if (str.startsWith("V2.1")) {
                    return 5;
                }
            } catch (Exception ignored) {

            }
        }
        ROMVERSION = i;
        return ROMVERSION;
    }


    private Object executeClassLoad(Class cls, String str, Class[] clsArr, Object[] objArr) {
        Object obj = null;
        if (!(cls == null || checkObjExists(str))) {
            Method method = getMethod(cls, str, clsArr);
            if (method != null) {
                method.setAccessible(true);
                try {
                    obj = method.invoke(null, objArr);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            }
        }
        return obj;
    }

    private Method getMethod(Class cls, String str, Class[] clsArr) {
        Method method = null;
        if (cls == null || checkObjExists(str)) {
            return method;
        }
        try {
            cls.getMethods();
            cls.getDeclaredMethods();
            return cls.getDeclaredMethod(str, clsArr);
        } catch (Exception e) {
            try {
                return cls.getMethod(str, clsArr);
            } catch (Exception e2) {
                return cls.getSuperclass() != null ? getMethod(cls.getSuperclass(), str, clsArr) : method;
            }
        }
    }

    private Class getClass(String str) {
        Class cls = null;
        try {
            cls = Class.forName(str);
        } catch (ClassNotFoundException ignored) {
        }
        return cls;
    }


    private boolean checkObjExists(Object obj) {
        return obj == null || obj.toString().equals("") || obj.toString().trim().equals("null");
    }


    private String getSystemProperty(String propName) {
        String line;
        BufferedReader input = null;
        try {
            Process p = Runtime.getRuntime().exec("getprop " + propName);
            input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
            line = input.readLine();
        } catch (IOException ex) {
            return null;
        } finally {
            try {
                if (input != null) {
                    input.close();
                }
            } catch (IOException var2) {

            }
        }
        return line;
    }
}

vivo

public class VivoHomeBadger extends Badger {

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        Intent intent = new Intent("launcher.action.CHANGE_APPLICATION_NOTIFICATION_NUM");
        intent.putExtra("packageName", context.getPackageName());
        intent.putExtra("className", componentName.getClassName());
        intent.putExtra("notificationNum", badgeCount);
        context.sendBroadcast(intent);
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList("com.vivo.launcher");
    }
}

中兴

public class ZTEHomeBadger extends Badger {

    private final Uri CONTENT_URI = Uri.parse("content://com.android.launcher3.cornermark.unreadbadge");

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount)
            throws ShortcutBadgeException {
        Bundle extra = new Bundle();
        extra.putInt("app_badge_count", badgeCount);
        extra.putString("app_badge_component_name", componentName.flattenToString());

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            context.getContentResolver().call(CONTENT_URI, "setAppUnreadCount", null, extra);
        }
    }

    @Override
    public List<String> getSupportLaunchers() {
        return new ArrayList<String>(0);
    }

} 

联想Zuk

需在设置 – 通知和状态栏 – 应用角标管理 中开启应用

public class ZukHomeBadger extends Badger {

    private final Uri CONTENT_URI = Uri.parse("content://com.android.badge/badge");

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        Bundle extra = new Bundle();
        extra.putInt("app_badge_count", badgeCount);
        context.getContentResolver().call(CONTENT_URI, "setAppBadgeCount", null, extra);
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Collections.singletonList("com.zui.launcher");
    }

}

Sony

public class SonyHomeBadger extends Badger {

    private static final String INTENT_ACTION = "com.sonyericsson.home.action.UPDATE_BADGE";
    private static final String INTENT_EXTRA_PACKAGE_NAME = "com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME";
    private static final String INTENT_EXTRA_ACTIVITY_NAME = "com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME";
    private static final String INTENT_EXTRA_MESSAGE = "com.sonyericsson.home.intent.extra.badge.MESSAGE";
    private static final String INTENT_EXTRA_SHOW_MESSAGE = "com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE";

    private static final String PROVIDER_CONTENT_URI = "content://com.sonymobile.home.resourceprovider/badge";
    private static final String PROVIDER_COLUMNS_BADGE_COUNT = "badge_count";
    private static final String PROVIDER_COLUMNS_PACKAGE_NAME = "package_name";
    private static final String PROVIDER_COLUMNS_ACTIVITY_NAME = "activity_name";
    private static final String SONY_HOME_PROVIDER_NAME = "com.sonymobile.home.resourceprovider";
    private final Uri BADGE_CONTENT_URI = Uri.parse(PROVIDER_CONTENT_URI);

    private AsyncQueryHandler mQueryHandler;

    @Override
    public void executeBadge(Context context, ComponentName componentName,
                             int badgeCount) throws ShortcutBadgeException {
        if (sonyBadgeContentProviderExists(context)) {
            executeBadgeByContentProvider(context, componentName, badgeCount);
        } else {
            executeBadgeByBroadcast(context, componentName, badgeCount);
        }
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList("com.sonyericsson.home", "com.sonymobile.home");
    }

    private static void executeBadgeByBroadcast(Context context, ComponentName componentName, int badgeCount) {
        Intent intent = new Intent(INTENT_ACTION);
        intent.putExtra(INTENT_EXTRA_PACKAGE_NAME, componentName.getPackageName());
        intent.putExtra(INTENT_EXTRA_ACTIVITY_NAME, componentName.getClassName());
        intent.putExtra(INTENT_EXTRA_MESSAGE, String.valueOf(badgeCount));
        intent.putExtra(INTENT_EXTRA_SHOW_MESSAGE, badgeCount > 0);
        context.sendBroadcast(intent);
    }

    /**
     * Send request to Sony badge content provider to set badge in Sony home launcher.
     *
     * @param context       the context to use
     * @param componentName the componentName to use
     * @param badgeCount    the badge count
     */
    private void executeBadgeByContentProvider(Context context, ComponentName componentName,
                                               int badgeCount) {
        if (badgeCount < 0) {
            return;
        }

        final ContentValues contentValues = createContentValues(badgeCount, componentName);
        if (Looper.myLooper() == Looper.getMainLooper()) {
            // We're in the main thread. Let's ensure the badge update happens in a background
            // thread by using an AsyncQueryHandler and an async update.
            if (mQueryHandler == null) {
                mQueryHandler = new AsyncQueryHandler(
                        context.getApplicationContext().getContentResolver()) {
                };
            }
            insertBadgeAsync(contentValues);
        } else {
            // Already in a background thread. Let's update the badge synchronously. Otherwise,
            // if we use the AsyncQueryHandler, this thread may already be dead by the time the
            // async execution finishes, which will lead to an IllegalStateException.
            insertBadgeSync(context, contentValues);
        }
    }

    /**
     * Asynchronously inserts the badge counter.
     *
     * @param contentValues Content values containing the badge count, package and activity names
     */
    private void insertBadgeAsync(final ContentValues contentValues) {
        mQueryHandler.startInsert(0, null, BADGE_CONTENT_URI, contentValues);
    }

    /**
     * Synchronously inserts the badge counter.
     *
     * @param context       Caller context
     * @param contentValues Content values containing the badge count, package and activity names
     */
    private void insertBadgeSync(final Context context, final ContentValues contentValues) {
        context.getApplicationContext().getContentResolver()
                .insert(BADGE_CONTENT_URI, contentValues);
    }

    /**
     * Creates a ContentValues object to be used in the badge counter update. The package and
     * activity names must correspond to an activity that holds an intent filter with action
     * "android.intent.action.MAIN" and category android.intent.category.LAUNCHER" in the manifest.
     * Also, it is not allowed to publish badges on behalf of another client, so the package and
     * activity names must belong to the process from which the insert is made.
     * To be able to insert badges, the app must have the PROVIDER_INSERT_BADGE
     * permission in the manifest file. In case these conditions are not
     * fulfilled, or any content values are missing, there will be an unhandled
     * exception on the background thread.
     *
     * @param badgeCount    the badge count
     * @param componentName the component name from which package and class name will be extracted
     *
     */
    private ContentValues createContentValues(final int badgeCount,
            final ComponentName componentName) {
        final ContentValues contentValues = new ContentValues();
        contentValues.put(PROVIDER_COLUMNS_BADGE_COUNT, badgeCount);
        contentValues.put(PROVIDER_COLUMNS_PACKAGE_NAME, componentName.getPackageName());
        contentValues.put(PROVIDER_COLUMNS_ACTIVITY_NAME, componentName.getClassName());
        return contentValues;
    }

    /**
     * Check if the latest Sony badge content provider exists .
     *
     * @param context the context to use
     * @return true if Sony badge content provider exists, otherwise false.
     */
    private static boolean sonyBadgeContentProviderExists(Context context) {
        boolean exists = false;
        ProviderInfo info = context.getPackageManager().resolveContentProvider(SONY_HOME_PROVIDER_NAME, 0);
        if (info != null) {
            exists = true;
        }
        return exists;
    }
}

三星

public class SamsungHomeBadger extends Badger {
    private static final String CONTENT_URI = "content://com.sec.badge/apps?notify=true";
    private static final String[] CONTENT_PROJECTION = new String[]{"_id", "class"};

    private DefaultBadger defaultBadger;

    public SamsungHomeBadger() {
        if (Build.VERSION.SDK_INT >= 21) {
            defaultBadger = new DefaultBadger();
        }
    }

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        if (defaultBadger != null && defaultBadger.isSupported(context)) {
            defaultBadger.executeBadge(context, componentName, badgeCount);
        } else {
            Uri mUri = Uri.parse(CONTENT_URI);
            ContentResolver contentResolver = context.getContentResolver();
            Cursor cursor = null;
            try {
                cursor = contentResolver.query(mUri, CONTENT_PROJECTION, "package=?", new String[]{componentName.getPackageName()}, null);
                if (cursor != null) {
                    String entryActivityName = componentName.getClassName();
                    boolean entryActivityExist = false;
                    while (cursor.moveToNext()) {
                        int id = cursor.getInt(0);
                        ContentValues contentValues = getContentValues(componentName, badgeCount, false);
                        contentResolver.update(mUri, contentValues, "_id=?", new String[]{String.valueOf(id)});
                        if (entryActivityName.equals(cursor.getString(cursor.getColumnIndex("class")))) {
                            entryActivityExist = true;
                        }
                    }

                    if (!entryActivityExist) {
                        ContentValues contentValues = getContentValues(componentName, badgeCount, true);
                        contentResolver.insert(mUri, contentValues);
                    }
                }
            } finally {
                if (cursor != null && !cursor.isClosed()) {
                    cursor.close();
                }
            }
        }
    }

    private ContentValues getContentValues(ComponentName componentName, int badgeCount, boolean isInsert) {
        ContentValues contentValues = new ContentValues();
        if (isInsert) {
            contentValues.put("package", componentName.getPackageName());
            contentValues.put("class", componentName.getClassName());
        }

        contentValues.put("badgecount", badgeCount);
        return contentValues;
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList(
                "com.sec.android.app.launcher",
                "com.sec.android.app.twlauncher"
        );
    }
}

小米

ublic class XiaomiHomeBadger extends Badger {

    public static final String INTENT_ACTION = "android.intent.action.APPLICATION_MESSAGE_UPDATE";
    public static final String EXTRA_UPDATE_APP_COMPONENT_NAME = "android.intent.extra.update_application_component_name";
    public static final String EXTRA_UPDATE_APP_MSG_TEXT = "android.intent.extra.update_application_message_text";
    private ResolveInfo resolveInfo;

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        try {
            Class miuiNotificationClass = Class.forName("android.app.MiuiNotification");
            Object miuiNotification = miuiNotificationClass.newInstance();
            Field field = miuiNotification.getClass().getDeclaredField("messageCount");
            field.setAccessible(true);
            try {
                field.set(miuiNotification, String.valueOf(badgeCount == 0 ? "" : badgeCount));
            } catch (Exception e) {
                field.set(miuiNotification, badgeCount);
            }
        } catch (Exception e) {
            Intent localIntent = new Intent(
                    INTENT_ACTION);
            localIntent.putExtra(EXTRA_UPDATE_APP_COMPONENT_NAME, componentName.getPackageName() + "/" + componentName.getClassName());
            localIntent.putExtra(EXTRA_UPDATE_APP_MSG_TEXT, String.valueOf(badgeCount == 0 ? "" : badgeCount));
            if (canResolveBroadcast(context, localIntent)) {
                context.sendBroadcast(localIntent);
            }
        }
        if (Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) {
            tryNewMiuiBadge(context, badgeCount);
        }
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    private void tryNewMiuiBadge(Context context, int badgeCount) throws ShortcutBadgeException {
        if (resolveInfo == null) {
            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_HOME);
            resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
        }

        if (resolveInfo != null) {
            NotificationManager mNotificationManager = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);
            Notification.Builder builder = new Notification.Builder(context)
                    .setContentTitle("")
                    .setContentText("")
                    .setSmallIcon(resolveInfo.getIconResource());
            Notification notification = builder.build();
            try {
                Field field = notification.getClass().getDeclaredField("extraNotification");
                Object extraNotification = field.get(notification);
                Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class);
                method.invoke(extraNotification, badgeCount);
                mNotificationManager.notify(0, notification);
            } catch (Exception e) {
                throw new ShortcutBadgeException("not able to set badge", e);
            }
        }
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList(
                "com.miui.miuilite",
                "com.miui.home",
                "com.miui.miuihome",
                "com.miui.miuihome2",
                "com.miui.mihome",
                "com.miui.mihome2",
                "com.i.miui.launcher"
        );
    }
}

华硕

public class AsusHomeBadger extends Badger {

    private static final String INTENT_ACTION = "android.intent.action.BADGE_COUNT_UPDATE";
    private static final String INTENT_EXTRA_BADGE_COUNT = "badge_count";
    private static final String INTENT_EXTRA_PACKAGENAME = "badge_count_package_name";
    private static final String INTENT_EXTRA_ACTIVITY_NAME = "badge_count_class_name";

    @Override
    public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
        Intent intent = new Intent(INTENT_ACTION);
        intent.putExtra(INTENT_EXTRA_BADGE_COUNT, badgeCount);
        intent.putExtra(INTENT_EXTRA_PACKAGENAME, componentName.getPackageName());
        intent.putExtra(INTENT_EXTRA_ACTIVITY_NAME, componentName.getClassName());
        intent.putExtra("badge_vip_count", 0);
        if (canResolveBroadcast(context, intent)) {
            context.sendBroadcast(intent);
        } else {
            throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString());
        }
    }

    @Override
    public List<String> getSupportLaunchers() {
        return Arrays.asList("com.asus.launcher");
    }
}

大家也可以直接去看看开源
https://gitee.com/yufeilong/badger-helper-master

更多framework实战开发干货,请关注下面“千里马学框架”

Android 实现不同Launcher 桌面角标的坑(Badge) 项目源码 Android桌面角标的适配确实是非常坑爹的需求。原生系统根本就没有这个功能,国内很多厂家效仿ios都自己定义了该功能。Android程序员就很苦逼,要适配很多机型。建议万不得已情况下还是不要进行这项工作。 其实这个功能和手机厂家没有直接的关系,而是和手机当前使用的launcher有直接关系。比如三星的手机我安装Asus桌面,这时候我们就不能适配三星launcher而要去适配华硕laun 阅读详情

相关推荐

android 快捷方式的权限判断。

里面的工具类是 通过 各自的实现来判断 华为,小米 oppo vivi等的应用是否 拥有快捷方式 的权限,如果没有的话,则需要去手动授权。

史上最全 Android 应用角标适配方法

Android 8.0之前原生是不支持应用角标的,是各个手机厂商自己在系统中实现的应用角标,并且部分厂商提供了设置的方式,所以需要对各个厂商的系统进行适配。 GitHub地址:https://github.com/jimmysuncpt/AppBadge 下面是针对各个手机厂商的系统进行适配的原理。 目录 0 公用方法 1 小米(支持) 2 华为(支持) 3 OPPO(不支持) 4...

孙强 Jimmy 的博客 1万+

Android 8.0系统中应用图标的适配技巧

今天小编就为大家分享一篇关于Android 8.0系统中应用图标的适配技巧,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧

android 角标最新设置方案

1、先大致说下主流厂商目前对角标的支持吧、 华为:支持、 小米:支持、 vivo:中高端支持、老版本不支持(7.0、8.0设备)、 oppo:支持红点角标但无数字、仅特定应用支持角标数字(微信 qq 0.0!!)、 三星:支持、 小众设备暂未统计; 2、小米、vivo oppo 适配注意的点(敲黑板) 先说小米:小米角标和通知相关、即通知数量==角标显示数量、官方似乎也意识到了此设计的缺陷、提出了解决方案:https://dev.mi.com/console/doc/detail?pId=.

BirdEatBug的博客 7287

大数据运维面试题及答案

1. 架构组成:- 2 个 NameNode(Active 活跃节点、Standby 备用节点),实时同步元数据(通过 JournalNode 集群,默认 3 个节点,存储 edits 日志,Active 写入、Standby 读取以保持元数据一致);- 容错性强:通过 RDD 的 “ lineage(血缘)” 机制,任务失败时可快速重算,无需从头执行。:集群 “大脑”,管理元数据(文件目录、块位置),实时响应客户端请求,数据存于内存,元数据镜像(fsimage)和编辑日志(edits)持久化到磁盘;

weixin_42795092的博客 915

从报错到优化:一次Gauss JDBC参数限制排查实录(32767参数上限避坑指南)

本文详细记录了排查GaussDB JDBC驱动因绑定参数数量超过32767上限而抛出`PSQLException`(报错信息为`Tried to send an out-of-range integer as a 2-byte value`)的全过程。文章深入分析了该限制的底层协议原理,并提供了应用层分批查询、使用临时表以及优化业务逻辑等多种解决方案,旨在帮助开发者规避此参数上限陷阱,构建更稳健的数据访问层。

rgv23456789的博客 222

Android App 厂商角标适配

一、背景本篇介绍一下笔者在维护IM应用时,设置App角标的相关经验。同时这里设置角标都是基于系统厂商的Launcher,没有适配三方的Launcher应用,因为我们统计下来发现近些年使用三方Launcher应用比较少了,大部分用户还是以系统Launcher为主。所在在我们的项目中,主要是适配各个厂商。二、厂商角标设置规则华为Bundlebundle =newBundle();bundle...

Android技术之家 434

axi时序图_(AXI)握手协议(pvld/prdy或者valid-ready)中ready打拍技巧

内容提要ready打拍的问题用FIFO的思路去解决用Buffer的思路去解决问题提出:ready时序如何优化?在valid/ready 握手协议中,valid 与 data的时序优化比较容易理解,(不熟悉valid/ready协议或者valid打拍方法的)大家可以参考上次推送(握手协议(pvld/prdy或者valid-ready或AXI)中Valid及data打拍技巧)。 但是有时候,关键路径是...

weixin_29763641的博客 3332

ShortcutBadger添加桌面角标(Badge)

1.简介:角标原本是苹果的ios中的东西,android原生并不支持角标,因为google的意思是让大家用notification(提示栏)即可,不过无妨,厉害的android第三方厂商可以通过在自定义的launcher(启动器)中操作来实现添加角标。   2.原理:添加角标的原理就是发送一个broadcast(广播),在广播的intent中指定需要被添加角标的应用的packagename(包名)...

weixin_34111790的博客 702

【深度学习】肺结节分割项目实战二:分割肺实质

在后续训练模型的时候如果直接使用原始的肺部CT图像,其中的非肺区域会对训练造成干扰,因此我们需要提取分割肺实质。这一部分参考了kaggle上的教程。 从这张CT图像中可以看出扫描器以外的部分为黑色,背景和肺内部颜色较深,非肺组织和骨头颜色较浅。我们的目的是将肺部分割出来。由于肺部区域和其他部分对比明显,我们可以设置一个合适的阈值对图像中的区域进行隔离。 import argparse import os import numpy as np from medpy.filter.smoothing imp

weixin_42182906的博客 7245

避开地图定位的坑:手把手教你处理GCJ-02和WGS-84坐标转换(2023最新版)

本文深入解析了GCJ-02与WGS-84坐标系转换的核心原理与常见误区,提供了详细的代码实现与精度控制方法。针对地图定位开发中的实际痛点,文章重点阐述了如何通过迭代逼近法实现高精度坐标转换,并给出了误差测试与业务场景下的工程实践指南,帮助开发者有效规避定位漂移等问题。

lstm7chronicler的博客 1181

Android 关于集成环信如何设置桌面角标

Android 关于集成环信如何设置桌面角标:小米、华为,vivo,oppo,魅族

huan132456765的博客 585

使用linuxdeployqt打包Qt程序问题及解决方法

安装过程中提示缺少依赖multiarch-support: 下载对应依赖包。安装过程中提示缺少libpq.so.5: 下载对应依赖包。下载libmysqlclient18/5.6.25。

weixin_74239923的博客 1061

Mui的APPLOGO数字角标小米问题

之前写了篇博客,生成jar包并添加进项目离线打包安卓APP,实现APP上LOGO的数字角标,但是最近有用户寄过来一台小米max3,因为APP启动后执行到显示数字角标的时候会崩。 通过Android Studio的Logcat获取到的日志是android.app.RemoteServiceException: Bad notification posted from package *: Coul...

qq_33042641的博客 1236

2025机械考研复试面试问题汇总篇(含13门科目),考研机械复试专业面试常见重点问题总结!考研机械复试专业面试准备看这一篇就够了!

(完整版内容:)1.汇集了本科各科的重点知识及多个机械名校800多个常见问题,共8.7万字185页,涵盖机械所以专业课的重点知识和常见问答。 2.涉及机械大类重点科目,包括:材料力学、控制工程、数控技术、机械制造技术基础、理论力学、液压传动、机械设计、机械原理、工程材料、互换性与技术测量、测试技术、汽车理论、程序设计与C语言等13门必修课。

weixin_56510835的博客 1865

爬虫逆向:Hook 技术原理与实战

Hook 技术​(钩子技术)是一种通过拦截和修改程序执行流程的技术手段。它允许开发者在目标程序的特定位置插入自定义代码,以改变程序的默认行为或获取运行时信息。Hook 技术广泛应用于调试、逆向工程、性能分析、安全防护等领域。Hook 技术在爬虫逆向中非常有用,能够有效获取和修改目标程序的数据。通过合理使用 Hook 工具和技术,可以显著提升爬虫的效率和成功率。但使用时需注意法律和道德问题,确保行为合规。

数据知道的博客 1万+

Android探索之旅 | 为应用添加角标(Badge)

Android探索之旅 | 为应用添加角标(Badge) 转载: http://www.jianshu.com/p/230736ba5e0d?utm_source=desktop&utm_medium=timeline?ref=myread

许浑的博客 1111

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

[贝聊科技]有关Android应用桌面角标(BadgeNumber)实现的探讨

作者:小强 贝聊移动开发部 Android工程师 前言:本文主要讲述了以下三方面: 怎么在Android系统下让自家的应用图标像iOS系统那样支持数字角标的显示? 在网上找不到现成的解决方案的情况下,该如何去寻找问题的突破口? 一种简洁性和扩展性都比较高的封装思路 先放一个传送门:GitHub传送门 1.Android系统下如何支持应用桌面角标(BadgeNumber)的显示 其实本来A...

weixin_33725272的博客 867

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Android 小米应用角标

根据小米官方文档说明:MIUI 6 至 MIUI 11 桌面角标适配说明 1. 默认逻辑 当应用向通知栏发送了一条通知 (除了进度条样式和常驻通知外),应用图标的右上角就会显示「1」。值得一提,角标的数字代表应用的通知数,即应用发送了「x」条通知,角标就会显示为「x」。 2. 开发者如何自定义角标数 如果开发者不满意默认逻辑,想要自定义角标的数字,可以通过调用接口告知系统,参考代码如下: try { Field field = notification.getClass().getDeclaredF

冬无雪的博客 2638

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

华为OSPF基本功能示例

所有的路由器都运行OSPF,并将整个自治系统划分为3个区域,其中DeviceA和DeviceB作为ABR来转发区域之间的路由。配置完成后,每台路由器都应学到自治系统内的到所有网段的路由。

weixin_55327573的博客 226

华为数通IA——16、数据中心网络基础:从通用计算到智能计算的网络演进

AI 计算的迭代过程中,当传递和更新中间参数时,发送到参数服务器的小规模流量会发生 Incast,网络可能出现丢包、拥塞、负载失衡等问题,一些流的 FCT(Flow Completion Time,流完成时间)被延长。RDMA(Remote Direct Memory Access,远程直接内存访问)是一种远端直接内存访问技术,利用相关的硬件和网络技术,将数据直接从一台服务器的内存传输到另一台服务器的内存,从而显著减少网络传输中服务器数据处理的延迟。不同业务场景下,数据中心网络采用的网络架构也有所不同。

qq_48378857的博客 464

极刻觅镜 | AI眼镜日报|洛图:Q3线上AR雷鸟、Rokid领跑,无屏清野销量居首、华为销额第一

11月18日,芯原股份(688521.SH)宣布推出面向新一代AI/AR眼镜的低功耗、高性能可穿戴子系统解决方案,新增面向眼镜应用的Nano-XR系列IP,并搭配低功耗处理器IP与子系统架构优化,覆盖图像视频、AI计算、语音音频、显示处理与图形渲染等能力。华为销量份额14.8%,销额份额30.1%居销额首位。据物奇微11月披露,极米「记得」系列AI记忆眼镜G1与AI记忆手环L1均搭载物奇微WQ7036智能音频主控芯片,用于声音采集、无线连接与低功耗运行,并可配合极米记得App做记录、转写与检索。

mengxi686的博客 302

华为路由策略 Route-Policy 详解:原理、匹配机制与路由控制案例

本文介绍了华为 VRP 平台中 Route-Policy 路由策略工具的基本原理、配置结构及应用方法,重点讲解 Node、If-match 和 Apply 三个核心组成部分,以及顺序匹配、唯一匹配和默认拒绝等匹配机制。通过路由控制理论与实验案例,演示如何利用 IP 前缀列表实现路由过滤,以及通过 Apply 修改路由属性,帮助理解 Route-Policy 在路由引入和路由控制中的实际应用。

一名热爱技术、专注实践的工程师,拥有一项实用新型专利及一项软件著作权。曾获国家级奖项7项、省级奖项30余项。专注网络技术与 AI Infra 领域,持续探索技术创新与工程实践,记录学习成长,分享技术经验,在探索中突破,在实践中精进。 497

华为/小米/比亚迪入股,国产激光雷达芯片厂商启动IPO

对于纵慧芯光来说,激光雷达放量打开了更大的市场,如何在客户自研加深的过程中保持产品价值与议价空间,将成为其汽车业务长期增长的关键考验。目前,VCSEL已进入多家雷达厂商的量产产品体系。自2015年成立以来,纵慧芯光已完成了14轮融资,累计金额超过11亿元,并吸引力华为旗下哈勃投资、小米长江产业基金、比亚迪、大疆、禾赛科技、速腾聚创等产业巨头和投资机构入股。VCSEL即垂直腔面发射激光器,是人脸识别、三维感知及激光测距等系统的重要光源,主要负责发射激光,配合接收器件与算法获取目标的距离、轮廓等信息。

高工智能汽车 201
上一篇: 想一想android桌面的未读计数角标应该如何设计呢?
下一篇: android系统framework的几个新面试题目(涉及binder,input,SurfaceFlinger带答案)
千里马学框架
博客等级 码龄6年 1万+粉丝 653原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

千里马学框架

帮助你了,就请我喝杯咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址