我编写了一个Node.js服务器,可以在Heroku(Global)上运行.在我的localhost中一切正常,但由于Heroku的时区是UTC,我的功能现在运行不正确.有人可以帮我设置一个默认时区吗?
这是我的代码:
router.get('/year/:yyear/:mmonth/:ddate/:hhours/:mminute/:sseconds/:fireTitle/:fireBody', function(req, res) {
var year1 = req.params.yyear;
var month1 = (req.params.mmonth)-1;
var date1 = req.params.ddate;
var hours1 = req.params.hhours;
var minute1 = (req.params.mminute);
var seconds1 = req.params.sseconds;
var datetime = new Date((new Date)*1 - 1000*3600*5.5 );
var responseObject= "Your Function has been set for : "+year1+month1+date1+hours1+minute1+seconds1 +" date "+ datetime;
var cron = require('node-schedule');
var date = new Date(year1, month1, date1, hours1, minute1, seconds1);
cron.scheduleJob(date, function(){
var request = require("request");
request("This Function will run" , function(error, response, …Run Code Online (Sandbox Code Playgroud) 我正在使用FCM进行通知,其中一切正常,但是直到应用程序打开,一旦我杀死(关闭)应用程序或在后台,我得到默认样式的通知,任何人都可以帮助我在应用程序时设置此通知样式已关闭(或任何其他建议).请帮助我,谢谢你提前
这是我的代码
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String title = "";
if (remoteMessage.getNotification().getTitle() != null){
title = remoteMessage.getNotification().getTitle();
}
String message = "";
if (remoteMessage.getNotification().getBody() != null){
message = remoteMessage.getNotification().getBody();
}
Log.e("notification","recieved");
sendNotification(title, message);
}
private void sendNotification(String title, String message) {
Intent intent = new Intent(this, MainActivity2.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0/*Request code*/, intent, PendingIntent.FLAG_ONE_SHOT);
Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
int color=getResources().getColor(R.color.dot_dark_screen2);
NotificationCompat.Builder notifiBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.account_outline)
.setColor(color)
.setDefaults(Notification.DEFAULT_SOUND)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
.setContentTitle(title)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setAutoCancel(true) …Run Code Online (Sandbox Code Playgroud)