[英]how can i Create notification
how can i create notification when the date current equals date in the base data(mysql) then the notification created with information. 当当前日期等于基础数据(mysql)中的日期时,我如何创建通知,然后使用信息创建通知。 i dont know how can i create the notification with this setting please help me it's for project
我不知道如何使用此设置创建通知,请帮助我用于项目
btn.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(final View view) {
StringRequest request = new StringRequest(Request.Method.POST, insert, new Response.Listener<String>() {
@override
public void onResponse(String response) {
}
}, new Response.ErrorListener() {
@override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(partietache.this,error.toString(),Toast.LENGTH_LONG).show();
}
}){
@override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> para = new HashMap<String , String>();
para.put("taskname", ed1.getText().toString().trim());
para.put("totalwork",ed4.getText().toString().trim());
para.put("datetask",ed2.getText().toString().trim());
para.put("starttime",ed3.getText().toString().trim());
para.put("description",ed5.getText().toString().trim());
return para;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(partietache.this);
requestQueue.add(request);
Snackbar snackbar = Snackbar.make(view,"Add with Succesful" , Snackbar.LENGTH_LONG);
snackbar.show();
new Timer().schedule(new TimerTask(){
public void run() {
partietache.this.runOnUiThread(new Runnable() {
@override
public void run() {
finish();
}
});
}
} , 4000);
}
});
@override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (not.isChecked()) {
Toast.makeText(getApplicationContext() , "Notification " + not.getTextOn().toString() , Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext() , "Notification " + not.getTextOff().toString() , Toast.LENGTH_SHORT).show();
}
}
In order to use push notifications you will need to do both server-side and client-side coding. 为了使用推送通知,您将需要同时进行服务器端和客户端编码。 Describing the whole process in detail would be too much for an SO answer, you should take a look at one of the many tutorials available online.
对于SO的回答来说,详细描述整个过程实在太多了,您应该看看在线上提供的许多教程之一。 Here's one to get you started.
这是一个入门的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.