コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notification_detail);

    if (!SessionContext.hasSession()) {
      startActivity(new Intent(this, LoginActivity.class));
    }

    new LiferayCrouton.Builder().withInfoColor(R.color.material_primary_crouton).build();

    ddlFormScreenlet = (DDLFormScreenlet) findViewById(R.id.ddl_form_screenlet);
    ddlFormScreenlet.setRecordId(getIntent().getIntExtra("recordId", 0));
    ddlFormScreenlet.setListener(this);
  }
コード例 #2
0
  @Override
  protected void onHandleIntent(Intent intent) {
    ConnectivityManager cm =
        (ConnectivityManager)
            getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
    boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();

    if (isConnected && SessionContext.hasSession()) {
      try {
        Cache cache = CacheSQL.getInstance();
        sendPortrait(cache);
        sendDocuments(cache);
        sendRecords(cache);
      } catch (Exception e) {
        LiferayLogger.e("Error syncing resources", e);
      }
    }
    CacheReceiver.completeWakefulIntent(intent);
  }