你的位置:首页 > 软件开发 > 操作系统 > Bmob基础

Bmob基础

发布时间:2015-05-07 00:00:13
BaaS是指专为移动应用开发者提供整合云后端的服务。开发者无需过多研究服务器端程序,而只需调用云计算平台提供的API,使用相应SDK,就能迅速完成数据存储、账户管理、消息推送、社交网络整合等功能。本文介绍了六款你必用的移动后端云服务/产品。    一款移动应用一旦需要后端服务的强 ...

Bmob基础

  BaaS是指专为移动应用开发者提供整合云后端的服务。开发者无需过多研究服务器端程序,而只需调用云计算平台提供的API,使用相应SDK,就能迅速完成数据存储、账户管理、消息推送、社交网络整合等功能。本文介绍了六款你必用的移动后端云服务/产品。  

  一款移动应用一旦需要后端服务的强大支撑时,开发商就必须考虑基础架构、服务集成、可伸缩性等繁冗复杂的问题。而在这些方面耗费的大量时间精力财力却不能直接提升App的用户体验。

为了解决这些问题,部分App发行商租用了譬如AWS(Amazon Web Services)的公有云服务,有的则部署内部专用的私有云服务。而移动开发团队越来越趋向于小规模化,架设需要高成本运营的服务器群或许并不是最好的方法,租用或免费使用后端云服务开始流行起来。

  BaaS(后端即服务)悄然兴起

  移动应用开发领域目前有一个BaaS(后端即服务:Backend as a Service)的概念。BaaS是指为移动应用开发者提供整合云后端的边界服务。现在,BaaS生态系统正从一个小众垂直领域迅速成为非常重要的行业环节。

  BaaS服务提供商的基础服务是数据/文件存储,主要帮助App开发者解决存储的问题。更进一步的集成服务则包括:账户管理、消息推送、社交网络整合、地理位置与广告等。BaaS分两种模式:一种是API模式,让开发者自己拓展代码;另一种是SDK模式,提供如iOS、Android及Windows Phone等的SDK。

  目前,国外比较知名的BaaS服务提供商是StackMob和Parse。在国内,Talking Data、友盟、Bmob、百度和新浪开放平台均有相关业务。

  本篇就带领大家一起来简单使用一下Bmob的开发,个人感觉还是很方便的。开发平台选择Android,由于IOS的高成本,无力支付高昂的硬件成本,所以就不再提IOS问题了。

  工欲善其事,必先利其器。首先我们需要到Bmob的官网:http://www.bmob.cn/

  Bmob基础

  下载需要的jar包(Android SDK),解压里面有三个文件,两个jar文件是我们开发需要的jar包,另外一个文件,是Bmob为我们提供的一个参考实例。下载好之后下载之后我们还需要注册一个账号,然后进入后台,点击创建应用,开始我们的Bmob之旅。

  Bmob基础

  Bmob为我们开发熟悉提供的了详细的文档支持,大家也可以参考一下官网的文档,本篇我将带领大家通过实现一个登录的功能来,来进一步认识Bmob的功能。

  第一步:登录Bmob,然后进入后台,点击创建应用,这是系统我们的生成了一个应用,点击进入应用,会看到系统为我们生成Key,到这里我们在Bmob上的工作就可以告一段落了。

  Bmob基础

  第二步:创建Android应用,通过Eclipse或Android Stdio新建一个工程项目,然后把我们刚刚下载好的jar包拷贝到工程的libs文件下,将jar包导入到我们的项目中。

  第三步:修改我们的布局文件,我们实现的是登录,所以我们需要写一个登录界面:

<RelativeLayout "http://schemas.android.com/apk/res/android"  ="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:paddingBottom="@dimen/activity_vertical_margin"  android:paddingLeft="@dimen/activity_horizontal_margin"  android:paddingRight="@dimen/activity_horizontal_margin"  android:paddingTop="@dimen/activity_vertical_margin"  tools:context=".MainActivity" >  <TextView    android:id="@+id/textView2"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_below="@+id/editText1"    android:layout_marginTop="24dp"    android:layout_toLeftOf="@+id/editText2"    android:text="@string/pwd" />  <TextView    android:id="@+id/textView1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignParentTop="true"    android:layout_marginTop="37dp"    android:layout_toLeftOf="@+id/editText1"    android:text="@string/name" />  <EditText    android:id="@+id/editText2"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignBaseline="@+id/textView2"    android:layout_alignBottom="@+id/textView2"    android:layout_toRightOf="@+id/textView1"    android:hint="@string/input_pwd"    android:singleLine="true"    android:password="true"    android:maxLength="8"    android:ems="10" />  <EditText    android:id="@+id/editText1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignBaseline="@+id/textView1"    android:layout_alignBottom="@+id/textView1"    android:layout_alignParentRight="true"    android:hint="@string/input_name"    android:singleLine="true"    android:ems="10" >    <requestFocus />  </EditText>  <Button    android:id="@+id/button1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignLeft="@+id/textView1"    android:layout_below="@+id/editText2"    android:layout_marginTop="22dp"    android:text="@string/login" />  <Button    android:id="@+id/button2"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignBaseline="@+id/button1"    android:layout_alignBottom="@+id/button1"    android:layout_marginLeft="48dp"    android:layout_toRightOf="@+id/button1"    android:text="@string/add" /></RelativeLayout>

原标题:Bmob基础

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录