2016-08-31 69 views
0

画面ピン/グラフィックキーロック付き電話機にバグがあります。それがなければうまくいく。画面にピン/グラフィックキーがある場合、プッシュ通知でアクティビティが開かない

プッシュ通知のユーザータップでメインアクティビティが開始され、そのすべてが開始されると、ピンまたはグラフィックキーがない場合、必要なアクティビティが開始されます。

これは私のGCMリスナーのコードです:

@Override 
public void onMessageReceived(String from, Bundle data) { 
    String id = data.getString("news_id"); 
    String message = data.getString("message"); 
    Random random = new Random(); 
    Intent intent = new Intent(this, SpecificNewsActivity.class); 
    intent.putExtra("newsId", id); 
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
    PendingIntent pendingIntent = PendingIntent.getActivity(this, random.nextInt(), intent, 
      PendingIntent.FLAG_ONE_SHOT); 

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) 
      .setSmallIcon(R.mipmap.ic_launcher) 
      .setContentTitle(getString(R.string.app_name)) 
      .setContentText(message) 
      .setAutoCancel(true) 
      .setSound(defaultSoundUri) 
      .setContentIntent(pendingIntent); 

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

    notificationManager.notify(random.nextInt(), notificationBuilder.build()); 
} 

任意のアイデアをどのようにこの問題を解決するには?

編集:この問題は、中国の携帯電話(Meizu、Xiaomi)にのみ存在するようです。

+0

デバイスにロックPIN /パスワードがありますか? –

+1

、デバイスにロック/ PINがある場合は、自分のデバイスでアクティビティ –

+0

@ cricket_007を開くことは理想的ではありません。 –

答えて

0

誰かがこれに直面している場合。質問は単純に解決されました。サーバーへのリクエストは、フラグメントコンテナを持つアクティビティからフラグメント自体に移動されました。これがなければ、XiaomiとMeizuの活動はフレームレイアウトの断片取引の段階で止まった。

関連する問題