• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AsyncCallback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.backendless.async.callback.AsyncCallback的典型用法代码示例。如果您正苦于以下问题:Java AsyncCallback类的具体用法?Java AsyncCallback怎么用?Java AsyncCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AsyncCallback类属于com.backendless.async.callback包,在下文中一共展示了AsyncCallback类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: subscribeToPushChannel

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
@Override
public boolean subscribeToPushChannel(final String channel) {
    if (!BNetworkManager.sharedManager().getNetworkAdapter().backendlessEnabled())
        return false;

    try {
        Backendless.Messaging.registerDevice(context.getString(R.string.google_project_number), channel, new AsyncCallback<Void>() {
            @Override
            public void handleResponse(Void response) {
                if(DEBUG) Timber.v("Device has been subscribed to channel " + channel);
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                if(DEBUG) Timber.v("Device subscription failed. " + fault.getMessage());
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

    return true;
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:25,代码来源:BBackendlessHandler.java


示例2: onRestorePasswordButtonClicked

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
private void onRestorePasswordButtonClicked() {
    if (etEmail.getText().toString().equals("")) {
        etEmail.setError(getString(R.string.error_email));
        return;
    }
    Backendless.UserService.restorePassword(etEmail.getText().toString(),
            new AsyncCallback<Void>() {
                @Override
                public void handleResponse(Void response) {
                    Toast.makeText(RestorePasswordActivity.this,
                            R.string.restore_email_sent,
                            Toast.LENGTH_SHORT).show();
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(RestorePasswordActivity.this,
                            getString(R.string.restore_email_fail),
                            Toast.LENGTH_SHORT).show();
                }
            });
}
 
开发者ID:ymittal,项目名称:android-login-screen,代码行数:23,代码来源:RestorePasswordActivity.java


示例3: onLoginWithFacebookButtonClicked

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
public void onLoginWithFacebookButtonClicked() {
    Map<String, String> fieldMap = new HashMap<>();
    fieldMap.put("name", "name");
    fieldMap.put("gender", "gender");
    fieldMap.put("email", "email");

    List<String> facebookPermissions = new ArrayList<>();
    facebookPermissions.add("email");

    Backendless.UserService.loginWithFacebook(LoginActivity.this, null, fieldMap, facebookPermissions,
            new AsyncCallback<BackendlessUser>() {
                @Override
                public void handleResponse(BackendlessUser response) {
                    Toast.makeText(LoginActivity.this, R.string.fb_login_success,
                            Toast.LENGTH_SHORT).show();
                    loginSuccess();
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(LoginActivity.this, getString(R.string.login_fail),
                            Toast.LENGTH_SHORT).show();
                }
            });
}
 
开发者ID:ymittal,项目名称:android-login-screen,代码行数:26,代码来源:LoginActivity.java


示例4: onLoginWithGoogleButtonClicked

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
private void onLoginWithGoogleButtonClicked() {
    Map<String, String> fieldMap = new HashMap<>();
    fieldMap.put("name", "name");
    fieldMap.put("gender", "gender");
    fieldMap.put("email", "email");

    List<String> googlePermissions = new ArrayList<>();

    Backendless.UserService.loginWithGooglePlus(LoginActivity.this, null, fieldMap, googlePermissions,
            new AsyncCallback<BackendlessUser>() {
                @Override
                public void handleResponse(BackendlessUser response) {
                    Toast.makeText(LoginActivity.this, R.string.google_login_success,
                            Toast.LENGTH_SHORT).show();
                    loginSuccess();
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(LoginActivity.this, getString(R.string.login_fail),
                            Toast.LENGTH_SHORT).show();
                }
            });
}
 
开发者ID:ymittal,项目名称:android-login-screen,代码行数:25,代码来源:LoginActivity.java


示例5: onLoginButtonClicked

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
private void onLoginButtonClicked() {
    Backendless.UserService.login(etEmail.getText().toString(),
            etPassword.getText().toString(),
            new AsyncCallback<BackendlessUser>() {
                @Override
                public void handleResponse(BackendlessUser response) {
                    Toast.makeText(LoginActivity.this, R.string.email_login_success,
                            Toast.LENGTH_SHORT).show();
                    loginSuccess();
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(LoginActivity.this, getString(R.string.login_fail) + fault.getMessage(),
                            Toast.LENGTH_SHORT).show();
                }
            }, checkboxRemember.isChecked());
}
 
开发者ID:ymittal,项目名称:android-login-screen,代码行数:19,代码来源:LoginActivity.java


示例6: getCategory

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
public void getCategory()
{
  progressDialog = ProgressDialog.show( EndlessTaggingActivity.this, "", "Loading", true );
  Backendless.Geo.getCategories( new AsyncCallback<List<GeoCategory>>()
  {
    @Override
    public void handleResponse( List<GeoCategory> geoCategories )
    {
      List<GeoCategory> categories = geoCategories;

      for( GeoCategory category : categories )
        categoriesNames.add( category.getName() );
      searchRectanglePoints( selectedCategories.isEmpty() ? categoriesNames : selectedCategories );
      progressDialog.cancel();
    }

    @Override
    public void handleFault( BackendlessFault backendlessFault )
    {
      progressDialog.cancel();
      Toast.makeText( EndlessTaggingActivity.this, backendlessFault.getMessage(), Toast.LENGTH_LONG ).show();
    }
  } );
}
 
开发者ID:Backendless,项目名称:EndlessTagging-Android,代码行数:25,代码来源:EndlessTaggingActivity.java


示例7: onRegisterButtonClicked

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
private void onRegisterButtonClicked() {
    if (etEmail.getText().toString().equals("")) {
        etEmail.setError(getString(R.string.error_email));
        return;
    }
    if (etPassword.getText().toString().equals("")) {
        etEmail.setError(getString(R.string.error_pass));
        return;
    }

    BackendlessUser newUser = new BackendlessUser();
    newUser.setEmail(etEmail.getText().toString());
    newUser.setProperty("name", etName.getText().toString());
    newUser.setPassword(etPassword.getText().toString());

    Backendless.UserService.register(newUser, new AsyncCallback<BackendlessUser>() {
        @Override
        public void handleResponse(BackendlessUser response) {
            Toast.makeText(RegisterActivity.this, R.string.register_success,
                    Toast.LENGTH_SHORT).show();
            startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
        }

        @Override
        public void handleFault(BackendlessFault fault) {
            Toast.makeText(RegisterActivity.this, R.string.register_fail,
                    Toast.LENGTH_SHORT).show();
        }
    });
}
 
开发者ID:ymittal,项目名称:android-login-screen,代码行数:31,代码来源:RegisterActivity.java


示例8: uploadImagetoOnlineDb

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
public void uploadImagetoOnlineDb(String _currentDate){
    context.registerReceiver(this.mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
    ArrayList<String> _tags = sapphireImgDbHelper.getAllTags();
    for(String eleTags : _tags){
        byte[] b_Array = sapphireImgDbHelper.imgquery(eleTags);
        Backendless.Files.saveFile(kapacRecentDB.queryPackage()+"/img_data", eleTags + ".png", b_Array, true, new AsyncCallback<String>() {
            @Override
            public void handleResponse(String s) {
                Log.d("VamHan",""+s);
            }

            @Override
            public void handleFault(BackendlessFault backendlessFault) {
                Log.d("VamHan",""+backendlessFault.getMessage());
            }
        });
    }
    if(uploadDateStoreDb.retrieveValue() == null){
        //new Data
        uploadDateStoreDb.insertNewDate(_currentDate);
    }else{

        SimpleDateFormat sdf = new SimpleDateFormat("[yyyy/MM/dd - HH:mm:ss]");
        try {
            Date Pdate = sdf.parse(uploadDateStoreDb.retrieveValue());
            Date Cdate = sdf.parse(_currentDate);
            int getDif = printDifference(Pdate, Cdate);
            if(getDif == 3){
                if(batteryStatus.isBatteryStatus() && batteryStatus.getBatteryPercentage() > 20) {
                    Log.d("NakedandFam","Approved");
                    uploadDateStoreDb.clearTable();
                    uploadDateStoreDb.insertNewDate(_currentDate);

                }

                }
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:hanuor,项目名称:sapphire,代码行数:42,代码来源:UploadDocs.java


示例9: searchRectanglePoints

import com.backendless.async.callback.AsyncCallback; //导入依赖的package包/类
private void searchRectanglePoints( List<String> categoriesNames )
{
  final ProgressBar progressBar = (ProgressBar) findViewById( R.id.progressBar );
  final TextView textView = (TextView) findViewById( R.id.textLoading );
  textView.setVisibility( TextView.VISIBLE );
  progressBar.setVisibility( ProgressBar.VISIBLE );
  backendlessGeoQuery = new BackendlessGeoQuery();
  backendlessGeoQuery.setSearchRectangle( new double[] { NELat, SWLon, SWLat, NELon } );
  backendlessGeoQuery.setCategories( categoriesNames );

  Backendless.Geo.getPoints( backendlessGeoQuery, new AsyncCallback<BackendlessCollection<GeoPoint>>()
  {
    @Override
    public void handleResponse( BackendlessCollection<GeoPoint> geoPointBackendlessCollection )
    {
      List<GeoPoint> points = geoPointBackendlessCollection.getCurrentPage();
      double newLatitude, newLongitude;
      adapter.clear();

      if( !points.isEmpty() )
        adapter.addAll( points );

      adapter.notifyDataSetChanged();

      for( GeoPoint point : points )
      {
        newLatitude = point.getLatitude();
        newLongitude = point.getLongitude();
        Map<String, String> newMetaData = point.getMetadata();
        String endlessTagging = newMetaData.get( "endlessTagging" );
        if( endlessTagging != null )
        {
          String pointName = newMetaData.get( "pointName" );
          String pointDescription = newMetaData.get( "pointDescription" );
          LatLng newPosition = new LatLng( newLatitude, newLongitude );
          googleMap.addMarker( new MarkerOptions().position( newPosition ).title( pointName ).snippet( pointDescription ).icon( BitmapDescriptorFactory.fromResource( R.drawable.marker_blue ) ) );
        }
      }
      textView.setVisibility( TextView.INVISIBLE );
      progressBar.setVisibility( ProgressBar.INVISIBLE );
    }

    @Override
    public void handleFault( BackendlessFault backendlessFault )
    {
      textView.setVisibility( TextView.INVISIBLE );
      progressBar.setVisibility( ProgressBar.INVISIBLE );
      Toast.makeText( EndlessTaggingActivity.this, backendlessFault.getMessage(), Toast.LENGTH_LONG ).show();
    }
  } );
}
 
开发者ID:Backendless,项目名称:EndlessTagging-Android,代码行数:52,代码来源:EndlessTaggingActivity.java



注:本文中的com.backendless.async.callback.AsyncCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DensityUtil类代码示例发布时间:2022-05-23
下一篇:
Java NodeVector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap