2. www.luxoft.com 2www.luxoft.com
About me
• Master degree Radiophysics and electronics
• Master degree Robotics
• Publication in CVPR conference - Human action
recognition
• More than 6 years experience as C++ software developer
• More than 7 years experience in teaching
• 2 years experience in entrepreneurship
• 2 years experience in machine learning
9. www.luxoft.com 9www.luxoft.com
public class SdlService extends Service {
//...
}
Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
12. www.luxoft.com 12www.luxoft.com
public class SdlService extends Service {
//The manager handles communication between the application and SDL
private SdlManager sdlManager = null;
//...
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (sdlManager == null) {
MultiplexTransportConfig transport = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
// The app type to be used
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.MEDIA);
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
SdlManagerListener listener = new SdlManagerListener() { … };
// Create App Icon, this is set in the SdlManager builder
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
// The manager builder sets options for your session
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
builder.setAppTypes(appType);
builder.setTransportType(transport);
builder.setAppIcon(appIcon);
sdlManager = builder.build();
sdlManager.start();
}
} Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
13. www.luxoft.com 13www.luxoft.com
public class SdlService extends Service {
//The manager handles communication between the application and SDL
private SdlManager sdlManager = null;
//...
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (sdlManager == null) {
MultiplexTransportConfig transport = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
// The app type to be used
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.MEDIA);
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
SdlManagerListener listener = new SdlManagerListener() { … };
// Create App Icon, this is set in the SdlManager builder
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
// The manager builder sets options for your session
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
builder.setAppTypes(appType);
builder.setTransportType(transport);
builder.setAppIcon(appIcon);
sdlManager = builder.build();
sdlManager.start();
}
} Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
14. www.luxoft.com 14www.luxoft.com
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
SdlManagerListener listener = new SdlManagerListener() {
@Override
public void onStart() {
// After this callback is triggered the SdlManager can be used to interact with the connected SDL
session (updating the display, sending RPCs, etc)
}
@Override
public void onDestroy() {
SdlService.this.stopSelf();
}
@Override
public void onError(String info, Exception e) {
}
};
Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
18. www.luxoft.com 18www.luxoft.com
public class SdlRouterService extends
com.smartdevicelink.transport.SdlRouterService {
//Nothing to do here
}
Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
20. www.luxoft.com 20www.luxoft.com
public class SdlReceiver extends SdlBroadcastReceiver {
@Override
public void onSdlEnabled(Context context, Intent intent) {
//Use the provided intent but set the class to the SdlService
intent.setClass(context, SdlService.class);
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
context.startService(intent);
}else{
context.startForegroundService(intent);
}
}
@Override
public Class<? extends SdlRouterService> defineLocalSdlRouterClass() {
//Return a local copy of the SdlRouterService located in your project
return com.company.mySdlApplication.SdlRouterService.class;
}
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
//your code here
}
}
Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
22. www.luxoft.com 22www.luxoft.com
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//If we are connected to a module we want to start our SdlService
SdlReceiver.queryForConnectedService(this);
}
}
Reference: https://www.smartdevicelink.com/en/guides/android/getting-started/integration-basics/
42. www.luxoft.com 42www.luxoft.com
class ProxyManager: NSObject {
…
func connect() {
// Start watching for a connection with a SDL Core
sdlManager.start { (success, error) in
if success {
// Your app has successfully connected with the SDL Core
}
}
}
…
}
Reference: https://www.smartdevicelink.com/en/guides/iOS/getting-started/integration-basics/