2016-08-14 90 views
1

我想通知使用通知如下:主要活動有以下代碼,但沒有任何顯示。通知沒有顯示在Android 19

mEmailSignInButton.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 
      NotificationCompat.Builder builder = 
        new NotificationCompat.Builder(MainActivity.this) 
          .setContentTitle("Enable Call Permission") 
          .setContentText("Please Enable or Accept call permission"); 
      int NOTIFICATION_ID = 12345; 

      Intent targetIntent = new Intent(MainActivity.this, PermissionActivity.class); 

      PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT); 
      builder.setContentIntent(contentIntent); 
      NotificationManager nManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
      nManager.notify(NOTIFICATION_ID, builder.build()); 
      save(); 
     } 
    }); 

回答