当前位置: 首页 > news >正文

私人做网站可靠吗百度助手下载安装

私人做网站可靠吗,百度助手下载安装,网站系统建设目标范本,适用于个人网站的域名文章目录 连接到真机使用通知通知的简单使用通知的详细信息 连接到真机 先用USB线将手机与电脑连接。 打开手机的设置,找到关于手机,点开之后,找到开发者选项界面。或者找到软件版本号,连续点击,系统会提示你点击几次能…

文章目录

      • 连接到真机
      • 使用通知
        • 通知的简单使用
        • 通知的详细信息

连接到真机

  先用USB线将手机与电脑连接。

  打开手机的设置,找到关于手机,点开之后,找到开发者选项界面。或者找到软件版本号,连续点击,系统会提示你点击几次能够打开开发者模式。

   然后就可以在Android studio顶部找到自己的真机运行就行了。

在这里插入图片描述

使用通知

通知的简单使用

  每条通知都要属于一个对应的渠道。每个应用程序都可以自由地创建当前应用拥有哪些通知渠道,但是这些通知渠道的控制权是掌握在用户手上的。用户可以自由地选择这些通知渠道的重要程度,是否响铃、是否振动或者是否要关闭这个渠道的通知。

  通知的重要等级主要有IMPORTANCE_HIGH、IMPORTANCE_DEFAULT、IMPORTANCE_LOW、IMPORTANCE_MIN这几种,对应的重要程度依次从高到低。

  修改activity_main.xml文件。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><Buttonandroid:id="@+id/sendNotice"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Send Notice" />
</LinearLayout>

  修改MainActivity.java文件。

public class MainActivity extends AppCompatActivity implements View.OnClickListener{@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Button sendNotice = (Button) findViewById(R.id.sendNotice);sendNotice.setOnClickListener(this);}@Overridepublic void onClick(View v){NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {NotificationChannel channel = new NotificationChannel("normal", "Normal", NotificationManager.IMPORTANCE_DEFAULT);manager.createNotificationChannel(channel);}NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "normal").setContentTitle("This is content title").setContentText("This is content text").setSmallIcon(R.mipmap.ic_launcher).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));Notification notification = builder.build();manager.notify(1, notification);}
}

在这里插入图片描述

通知的详细信息

  实现通知的点击效果需要使用PendingIntent,它主要提供了几个静态方法用于获取PendingIntent的实例,可以根据需求来选择是使用getActivity()方法、getBroadcast()方法,还是getService()方法。这几个方法所接收的参数都是相同的:第一个参数是Context;第二个参数一般用不到,传入0即可;第三个参数是一个Intent对象。第四个参数用于确定PendingIntent的行为,有FLAG_ONE_SHOT、FLAG_NO_CREATE、FLAG_CANCEL_CURRENT和FLAG_UPDATE_CURRENT这4种值可选,通常情况下这个参数传入0就可以了。

  新建一个活动NotificationActivity,修改布局文件。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent" ><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:textSize="24sp"android:text="This is notification layout"/>
</RelativeLayout>

  修改MainActivity.java文件。

public class MainActivity extends AppCompatActivity implements View.OnClickListener{@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Button sendNotice = (Button) findViewById(R.id.sendNotice);sendNotice.setOnClickListener(this);}@Overridepublic void onClick(View v){Intent intent = new Intent(this, NotificationActivity.class);PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {NotificationChannel channel = new NotificationChannel("normal", "Normal", NotificationManager.IMPORTANCE_DEFAULT);manager.createNotificationChannel(channel);}NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "normal").setContentTitle("This is content title").setContentText("This is content text").setSmallIcon(R.mipmap.ic_launcher).setContentIntent(pi).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));Notification notification = builder.build();manager.notify(1, notification);}
}

在这里插入图片描述

http://www.hkea.cn/news/834076/

相关文章:

  • 网站开发技术包括郑州网站关键词排名
  • 网站开发预算怎么算百度竞价ocpc
  • 成都锐度设计公司怎么样优化大师怎么提交作业
  • 租用网站服务器东莞市网站建设
  • 馆陶县网站网站运营管理
  • 西双版纳傣族自治州医院seo搜索优化网站推广排名
  • wordpress站点网址小吃培训2000元学6项
  • 郑州网站制作天强科技seo百度发包工具
  • 江阴市住房与建设局网站seo工资多少
  • wordpress image.php南宁百度首页优化
  • 谢家华做网站百度指数与百度搜索量
  • wordpress 安装 ubuntu整站优化代理
  • 做公司网站协议书模板下载百度竞价推广公司
  • 福田蒙派克6座二手值多少钱重庆seo点击工具
  • 有了域名 怎么做网站外贸网站推广方法之一
  • 审美网站长春网站建设路
  • 网站 管理系统域名查询注册信息查询
  • 专业网站设计发展前景推广网站软文
  • 怎么建设seo自己网站网站优化推广教程
  • 最新app开发软件石家庄网站建设seo公司
  • 江苏自助建站系统哪家好推广网站要注意什么
  • 唐河做网站关键字搜索引擎
  • 松江专业做网站公司seo视频教程百度云
  • 淄博品质网站建设竞价推广怎么样
  • 搜狗站群系统资源网站优化排名优化
  • 建设一个网站哪家好网站推广优化的原因
  • 做网站的上海公司有哪些情感链接
  • 梧州做网站建设数字营销公司
  • 加强新闻网站建设建议seo高手培训
  • 安丘网站建设制作怎样制作网页设计