小编Jak*_*den的帖子

Android Oreo Notification崩溃系统UI

我已经设法在较旧的API中使用通知,但不是Oreo.创建通知会导致我的应用程序仍能正常工作(logcat中没有消息),但是当Activity运行时,SystemUI会在无限循环中崩溃并重新启动.这是systemui进程的logcat错误:

java.lang.IllegalArgumentException: width and height must be > 0
Run Code Online (Sandbox Code Playgroud)

我的代码:

private void showPlayingNotification() {
        NotificationCompat.Builder builder = mNotificationUtils.getAndroidChannelNotification(this, "Play", mMediaSessionCompat);
        if( builder == null ) {
            Log.i("Play Notification","No notification found!");
            return;
        }

        mNotificationUtils.getManager().notify(101,builder.build()); 
}
Run Code Online (Sandbox Code Playgroud)

我在我创建的MediaPlayerService的onCreate中初始化了mNotificationUtils.

public class NotificationUtils extends ContextWrapper {

    private NotificationManager mManager;
    public static final String AUDIO_CHANNEL_ID = "com.liftyourheads.dailyreadings.dailyReadingsAudio";
    public static final String AUDIO_CHANNEL_NAME = "Daily Readings Audio Stream";

    public NotificationUtils(Context base) {
        super(base);
        createChannels();
    }

    public void createChannels() {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            // create android …
Run Code Online (Sandbox Code Playgroud)

java notifications android android-mediaplayer android-8.0-oreo

14
推荐指数
3
解决办法
3763
查看次数

Android Mapbox 标记标签

我试图弄清楚如何使动态生成的标记列表在地图上(而不是在信息窗口中)显示动态文本标签。我知道这是可能的,因为我已经在 Mapbox Studio 中使用过这个功能 - 我只是不知道如何在 Android 上做到这一点!我考虑过创建一个包含文本的静态位图图标,但这与 Mapbox Studio 版本相比似乎不太灵活,所以如果可以的话我想避免它!有什么建议么?

android label mapbox mapbox-marker

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