2016-06-12 13 views
0

私はアンドロイドを新しくしました。誰かが特定の時刻にアプリの表示通知をするための詳細コードを表示できますか?アンドロイドの特定の時間帯に通知を表示

コードを詳細に表示するとよいでしょう。

私はローカル通知のみを使用することを知っています。

code is here. 

long when = Calendar.getInstance()。getTimeInMillis(); + = 10000のとき ;

 Intent intent = new Intent(getApplicationContext(),MainActivity.class); 

     PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(),1,intent,PendingIntent.FLAG_UPDATE_CURRENT); 
     long[] pattern = {500,500}; 

     NotificationCompat.Builder notification = 
       (NotificationCompat.Builder) new NotificationCompat.Builder(this) 
         .setSmallIcon(R.drawable.notification1) 
         .setContentTitle("My notification") 
         .setContentText("Hello World!") 
         .setContentIntent(pendingIntent) 
         .setLights(Color.BLUE, 500, 500) 
         .setAutoCancel(true) 
         .setVibrate(pattern) 
         .setDefaults(Notification.DEFAULT_SOUND); 

     NotificationManager mNotificationManager = 
       (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 

// mIdでは、通知を後で更新することができます。 mNotificationManager.notify(1、notification.build());

+0

将来的にあなたには、いくつかの時点で実行されるアプリケーションをスケジュールすることができますあなたにコードを書く/コピー&ペーストするためのaskingus。 – Azamantes

+0

今あなたは見ていることができます...私はアラームマネージャーを使用する必要があることを知っているが、その使用方法を知らない –

答えて

関連する問題