前面的叨叨:由于阿里云的飞燕平台刚推出不久所以很多问题网上都没解决方案,所以只能通过发送工单去解决,譬如说想创立一个自己品牌的App在导入代码这一步就出现了问题,由于某些原因我们并不能fq,但在导入sdk的同时报错了google的错误,本来以为是缺了jar,但咨询后发现sdk加上的那两句代码其实是无用的。注释掉
/* implementation 'com.google.android.gms:play-services-auth:15.0.1'*/就可以了。
不知是不是安卓系统的原因还是网络原因这个sdk的demo不太稳定,亲测在安卓低版本下会出现登录不成功的原因和闪退情况。
sdk里提供了一个入口的例子操作可借鉴。
package com.aliyun.iot.ilop.demo.page.ilopmain; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.aliyun.alink.linksdk.tmp.TmpSdk; import com.aliyun.alink.linksdk.tmp.api.OutputParams; import com.aliyun.alink.linksdk.tmp.device.panel.PanelDevice; import com.aliyun.alink.linksdk.tmp.device.panel.listener.IPanelCallback; import com.aliyun.alink.linksdk.tmp.device.panel.listener.IPanelEventCallback; import com.aliyun.alink.linksdk.tmp.listener.IDevListener; import com.aliyun.alink.linksdk.tmp.utils.ErrorInfo; import com.aliyun.iot.aep.sdk.framework.AActivity; import com.aliyun.iot.demo.R; import com.aliyun.iot.ilop.demo.dialog.HSVDialog; import com.aliyun.iot.ilop.demo.page.bean.EventCallbackbean; import com.aliyun.iot.ilop.demo.page.bean.PalettesDialogBean; import com.aliyun.iot.ilop.demo.page.bean.RequestInvokeServiceBean; import com.aliyun.iot.ilop.demo.page.bean.RequestPropertiesBean; import com.aliyun.iot.ilop.demo.page.bean.ResponsePropertiesBean; import com.aliyun.iot.ilop.demo.page.bean.StatusBean; import com.aliyun.iot.ilop.demo.utils.ColorTools; import com.aliyun.iot.ilop.demo.view.CircleView; import com.aliyun.iot.ilop.demo.view.LampsSwitchView; import com.aliyun.iot.ilop.demo.view.SimpleToolBar; import com.google.gson.Gson; import com.taobao.accs.utl.ALog; import java.util.List; public class LampsActivity extends AActivity { private static final String TAG = "LampsActivity"; private static final String OFF_LINE_HINT = "设备离线,无法操作"; private SimpleToolBar simpleToolBar; private LinearLayout palettesLl; private CircleView hsvCircleView; private String iotId; private PanelDevice panelDevice; private LampsSwitchView leftLampsSwitchView, rigthLampsSwitchView; private TextView statusTv; private Gson gson; private ResponsePropertiesBean responsePropertiesBean; private RequestPropertiesBean requestPropertiesBean = new RequestPropertiesBean(); private boolean rightOnLineFlag; private boolean leftOnLineFlag; private static int requestCode = 96; public static int finishResultCode = 97; public static int titleResultCode = 98; private String title; private int status = 0; private boolean firstPropertiesFlag = false; @Override protected void onCreate(Bundle bundle) { super.on