小编D4N*_*14L的帖子

通知栏显示大图标和小图标

我的应用程序中的通知栏仅显示自动收报机中的小图标(应该如此).但是,当"阴影"被拉下时,它会显示自动收报机中的小图标,以及我在Notification.Builder中设置的大图标.这是我的代码:

if (Build.VERSION.SDK_INT > 10){
            notification = new Notification(R.drawable.ic_stat_mintchip,
                    "This is a test",
                    System.currentTimeMillis());
            notification.largeIcon = (((BitmapDrawable)c.getResources().getDrawable(R.drawable.ic_launcher)).getBitmap());
            notification.defaults |= Notification.DEFAULT_ALL;
            notification.number += 1;
            notification.flags |= Notification.FLAG_AUTO_CANCEL;

        } else {
            notification = new Notification(R.drawable.ic_stat_mintchip,
                    "This is a test",
                    System.currentTimeMillis());

                notification.flags |= Notification.FLAG_AUTO_CANCEL;
                notification.defaults |= Notification.DEFAULT_ALL;
                notification.number += 1;
        }
}
Run Code Online (Sandbox Code Playgroud)

我不太清楚为什么会这样.任何帮助?

notifications android android-notifications android-notification-bar

6
推荐指数
2
解决办法
3万
查看次数

在Android中发送短信

嘿,我一直在制作需要发送短信的Android应用.这是我目前的代码:

public class getMessage extends Service {
@Override
public IBinder onBind(Intent intent) {
    return null;
}

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    client Phone = new client();


    String[] msg = Phone.getMsg(user[0],user[1]);
    PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, getMessage.class), 0);
    SmsManager man = SmsManager.getDefault();
    Log.e("GOT MESSAGE", msg[0]+ " : " +msg[1]);
    man.sendTextMessage(msg[0], null, msg[1], pi, null);
    Log.e("Message", "Sent the message?");
}
Run Code Online (Sandbox Code Playgroud)

现在,由于某种原因,短信将不会使用此代码发送,我不知道为什么.我希望这里有人可以帮助我找出为什么这条消息不会发送.

不会引发任何错误,日志中不会显示任何内容(除了我自己在代码中创建的日志消息).此外,清单确实有正确的标签.

建议?

java sms android

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