sensorhub-cloud-iot
                                
                                 sensorhub-cloud-iot copied to clipboard
                                
                                    sensorhub-cloud-iot copied to clipboard
                            
                            
                            
                        I can't find the key pair (private and public) on the device
I can't find the key pair (private and public) on the device
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!
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?
Thank you evgkarasev!! The certificate was on the sd! Used it and now it's OK