6

私はアンドロイド プロジェクトに取り組んでおり、次のコードを改善する方法を見つけようとしています。これを開発した方法が正しいかどうかを知る必要があります。

  • 通知は、データベースから取得される GCM 通知です

私の質問は、私が何度か呼び出しているインテント サービスに関するものです。大丈夫ですか?これをどのように改善する必要がありますか?

while (((notification)) != null)
{{
    message = notification.getNotificationMessage();
    //tokenize message
    if ( /*message 1*/) {
         Intent intent1= new Intent(getApplicationContext(),A.class);
         intent1.putExtra("message1",true);
         startService(intent1);
    } else
    {
         Intent intent2= new Intent(getApplicationContext(),A.class);
         intent2.putExtra("message2",true);
         startService(intent2);
    }
}
//retrieve next notification and delete the current one
}
4

1 に答える 1