奥利奥

时间:2018-01-08 06:06:53

标签: android android-notifications android-alarms android-8.1-oreo

我一直在通过Anna Xu的youtube tutorial制作一个闹钟

她最终将她的代码保存在If语句中,似乎点击并提示她的应用程序就好了。我已根据在Pixel XL上搜索Oreo的修复程序进行了修改。这就是我到目前为止所做的:

// notification parameters
        int notifyID = 1;
        String CHANNEL_ID = "my channel_01";
        CharSequence name = "Hello";
        int importance = NotificationManager.IMPORTANCE_HIGH;
        NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
        // set up the notification service
        NotificationManager notify_manager = (NotificationManager)
                getSystemService(Context.NOTIFICATION_SERVICE);
        notify_manager.createNotificationChannel(mChannel);

        Notification notification_popup = new Notification.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher_foreground)
                .setContentTitle("An alarm is going off!")
                .setContentText("Click me!")
                .setChannelId(CHANNEL_ID).build();
        // set up notification start command
        notify_manager.notify(0, notification_popup);

这会在闹钟响起时显示通知,但点击不会启动应用程序,实际上我认为你根本不能点击它,你只能将它滑开。我只是想能够点击通知将应用程序带到前台。我是Java和Android Studio的新手,由于Oreo系统闹钟无法信任,所有这些都是必要的。任何帮助都会很棒。

1 个答案:

答案 0 :(得分:0)

{
"aaa": "value",
"bbb": "value",
"ccc":"value",
"resultSuccess": "{
  \"geometry\": {
    \"type\": \"Point\",
    \"coordinates\": [
      4.764638612000056,
      52.308615736000036
    ]
  }
}"
}