2017-02-04 2 views
2

내 앱에서 알림을 수신 중이며 로그에서 볼 수 있습니다. 그러나 일부 휴대 전화에서는 표시되지 않습니다. 예 : One plus A0001 (Android 5.1.1 API22). 다른 stackoverflow 질문을 읽고 필요한 모든 메서드가 있는지 확인했습니다. 일부 탐험 후에 Cyanogenmod가이 문제의 원인인지 알게되었습니다. 앱 알림이 표시됩니다.일부 Android 휴대 전화에 알림이 표시되지 않습니다.

public class MainActivity extends AppCompatActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Intent intent = new Intent(this, MainActivity.class); 
    PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0); 
    Notification n = new Notification.Builder(this) 
      .setContentTitle("New mail from " + "[email protected]") 
      .setContentText("Subject") 
      .setSmallIcon(R.drawable.ic_launcher) 
      .setContentIntent(pIntent) 
      .setAutoCancel(true).build(); 

    NotificationManager notificationManager = 
      (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 

    notificationManager.notify(6578, n); 
} 

위의 코드는 다른 모든 모바일에서 작동합니다.

+0

'NotificationCompat'을 사용해보세요. 한번 해봐. – Wizard

+0

@Wizard 이미 시도했습니다. 하지만 아무 쓸모가 없어 –

답변

0

앱의 알림 권한을 확인하십시오. 휴대 전화로 제어 할 수 있습니다. 설정 또는 사전 설치된 앱에있을 수 있습니다. 특히 중국에서는 많은 휴대 전화에 타사 앱의 권한을 제어하는 ​​"权限 管 家"이라는 앱이 사전 설치되어 있습니다. 알림 표시 줄에 알림 표시, 백그라운드 실행 중 또는 화면 잠금 중일 때 인터넷에 연결하는 등의 작업.

+0

그 설정을 확인 @ 오카 장 –

관련 문제