Пример #1
0
 @Override
 protected void onDestroy() {
   if (isNetworkConnected()) {
     unbindService(mServiceConn);
   }
   super.onDestroy();
 }
Пример #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wait_bar);

    setResult(RESULT_CANCELED);

    if (!isNetworkConnected()) {
      showAlertDialog(CONNECTION_ALERT);
    } else {
      bindService(
          new Intent("com.android.vending.billing.InAppBillingService.BIND"),
          mServiceConn,
          Context.BIND_AUTO_CREATE);
      if (getIntent().getExtras() != null) {
        fileName = getIntent().getExtras().getString(FILE_NAME_KEY);
        title = getIntent().getExtras().getString(TITLE_KEY);
        subtitle = getIntent().getExtras().getString(SUBTITLE_KEY);
        // Using Locale.US to avoid different results in different locales
        productId = FilenameUtils.getName(fileName).toLowerCase(Locale.US);
        productId = productId.substring(0, productId.indexOf("_.pdf"));
      }
    }
  }