Hi, i followed the instruction from github for install the SDK, but it's does'nt work... I can't do the import:
import io.matchmore.sdk.MatchMore;
import io.matchmore.sdk.MatchMoreConfig;
import io.matchmore.sdk.MatchMoreSdk;
import io.matchmore.sdk.api.models.Publication;
import io.matchmore.sdk.api.models.Subscription;
What i don't understand it is i did the same (controlled 2 version) 2 weeks ago and it's work
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
let location = Location(latitude: Double, longitude: Double, altitude: 0.0, horizontalAccuracy: 0.0, verticalAccuracy: 0.0)
let pin = PinDevice(name: "pin device \(deviceNo)", location: location)
Matchmore.createPinDevice(pinDevice: pin) { result in
switch result {
case let .success(device):
break
case let .failure(error):
break
}
}
matchmore.createPinDevice(_);
/**
* Creates new pin device. Device created this way can be accessed via devices store: devices property or through callback's result.
*
* @property pinDevice [PinDevice] object that will be created on Matchmore's cloud.
* @property success Callback that returns successful response's object from the Matchmore's cloud.
* @property error Callback that returns error response from the Matchmore's cloud.
*/
fun createPinDevice(pinDevice: PinDevice, success: SuccessCallback<PinDevice>?, error: ErrorCallback?)
/**
* Creates new publication attached to device with given id.
*
* @property publication [Publication] object that will be created on Matchmore's cloud.
* @property deviceWithId id of the device that publication will be attached to.
* @property success Callback that returns successful response's object from the Matchmore's cloud.
* @property error Callback that returns error response from the Matchmore's cloud.
*/
fun createPublication(publication: Publication, deviceWithId: String? = null, success: SuccessCallback<Publication>?, error: ErrorCallback?)
Note that first you need to create pinDevice and than in it's callback you will receive created pinDevice with proper Id.
This Id needs to be passed to publication deviceWithId
MatchmoreSDK matchmore = Matchmore.getInstance();
PinDevice pinDeviceThatWillBeCreated = new PinDevice();
MatchmoreLocation location = new MatchmoreLocation();
location.setLatitude(10.0);
location.setLongitude(10.0);
pinDeviceThatWillBeCreated.setLocation(location);
matchmore.createPinDevice(pinDeviceThatWillBeCreated, createdPinDevice -> {
Publication publication = new Publication("Test Topic", 20d, 100000d);
matchmore.createPublication(publication, createdPinDevice.getId(), createdPublication -> {
Log.d("JavaExample", createdPublication.getId());
return Unit.INSTANCE;
}, e -> {
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});
return Unit.INSTANCE;
}, e -> {
Log.d("JavaExample", e.getMessage());
return Unit.INSTANCE;
});