sensorhub-cloud-iot icon indicating copy to clipboard operation
sensorhub-cloud-iot copied to clipboard

I can't find the key pair (private and public) on the device

Open qq601654720 opened this issue 8 years ago • 3 comments

I can't find the key pair (private and public) on the device

qq601654720 avatar Aug 11 '17 05:08 qq601654720

It seems that MQTT connection should be configured first. It uses SharedPreferences to store the connection details, so it could be configured via intent, just take some <DEVICE_ID> that will be registered later:

adb shell am startservice -a com.example.androidthings.sensorhub.mqtt.CONFIGURE -e project_id \
<PROJECT_ID> -e cloud_region <REGION> -e registry_id <REGISTRY_ID> -e device_id \
<DEVICE_ID> com.example.androidthings.sensorhub/.cloud.CloudPublisherService

After that, device could be registered on GCP with taken <DEVICE_ID> and public key certificate.

gcloud beta iot devices create <DEVICE_ID> --project=<PROJECT_ID> --region=<CLOUD_REGION> \
--registry=<REGISTRY_ID> --public-key path=cloud_iot_auth_certificate.pem,type=rs256

The only issue is that the app should be restarted manually as soon configuration is done.

Confirmed. It works like a charm!

evgkarasev avatar Aug 15 '17 11:08 evgkarasev

I too can´t find the key pair! Sorry I don't understand evgkarasev's instructions: where is the cloud_iot_auth_certificate.pem? When I run the second set command I get permission denied! Can you help?

Pedotech avatar Dec 02 '17 20:12 Pedotech

Thank you evgkarasev!! The certificate was on the sd! Used it and now it's OK

Pedotech avatar Dec 02 '17 21:12 Pedotech