Cloud SDK getting started issue

My goal is to write an Android app in Kotlin to interface with P1 based hardware, but it seems that I may have underestimated the complexity of it. Based on Android SDK | Reference | Particle it should be as simple as adding implementation ‘io.particle:cloudsdk:1.0.1’ to the dependencies of my app and proceed with coding. So I opened a new Basic Activity app in Android studio, added the dependency, and tried to build the app. It immediately complains “Could not find io.particle:cloudsdk:1.0.1.” To be honest, I have downloaded and built and ran Tinker, but the whole project setup I find very convoluted (admittedly limited Android experience, 6 months of Kotlin). I really feel the pressure with hardware due soon and software appearing more daunting than I thought. Can someone help perhaps, even if it is a simple Kotlin based app that can be used as a starting point ?
I am running Android Studio 2021.2.1, minimum SDK is API level 21, and my build.gradle file is pasted below:
plugins {
id ‘com.android.application’
id ‘org.jetbrains.kotlin.android’
}

android {
compileSdk 32

defaultConfig {
    applicationId "com.example.myapplication"
    minSdk 21
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}
buildFeatures {
    viewBinding true
}

}

dependencies {
implementation ‘io.particle:cloudsdk:1.0.1’
implementation ‘androidx.core:core-ktx:1.7.0’
implementation ‘androidx.appcompat:appcompat:1.4.1’
implementation ‘com.google.android.material:material:1.6.0’
implementation ‘androidx.constraintlayout:constraintlayout:2.1.4’
implementation ‘androidx.navigation:navigation-fragment-ktx:2.4.2’
implementation ‘androidx.navigation:navigation-ui-ktx:2.4.2’
testImplementation ‘junit:junit:4.13.2’
androidTestImplementation ‘androidx.test.ext:junit:1.1.3’
androidTestImplementation ‘androidx.test.espresso:espresso-core:3.4.0’
}

Before you get too far, have you already secured your entire supply of P1s that you will be needing for your project? The P1 is deprecated and the last request to buy is June 30, 2022.

The P2 does not use SoftAP based configuration and does not use the Android Setup SDK at all, so none of the work that you do setting that up will be helpful with the P2. The P2 uses BLE-based configuration. A sample React Native application will be provided instead of the Device Setup SDK.

Hi Rick, I appreciate your response tremendously. Fortunately I was contacted end of last year by one of your colleagues and informed about the upcoming P2. However, I elected to continue with the P1 for 2022 during which we will bring to life (hopefully) our first prototype and use that for limited field testing as well as checking market acceptance of the product. I have 30x P1 devices that will suffice for this purpose. Our first production model design will definitely be P2 based. So, I think you are right; for these field trial models the claiming and Wi-Fi setup can be done manually, and hence only need operational interaction through the Android app. I have not thought through this properly, but I guess the easiest way to allow my “trial customers” to interact with a product will be for them to register for a Particle account, and then claim and set up the device manually with Tinker. Would you agree or recommend another approach ?

Hi Rick,
I forgot to tag you in my forum response so I thought to reply by email as well.

I appreciate your response tremendously. Fortunately I was contacted end of last year by one of your colleagues and informed about the upcoming P2. However, I elected to continue with the P1 for 2022 during which we will bring to life (hopefully) our first prototype and use that for limited field testing as well as checking market acceptance of the product. I have 30x P1 devices that will suffice for this purpose. Our first production model design will definitely be P2 based. So, I think you are right; for these field trial models the claiming and Wi-Fi setup can be done manually, and hence only need operational interaction through the Android app. I have not thought through this properly, but I guess the easiest way to allow my “trial customers” to interact with a product will be for them to register for a Particle account, and then claim and set up the device manually with Tinker. Would you agree or recommend another approach ?

You mention sample code can be provided, can you venture a timeline for that ?

Sincerely
Rudolf Kruger

Using the mobile apps to create an account and claim the device presents its own set of problems: You probably want all of your devices to be in a product. Aside from having to do this at scale, it’s what is necessary in order to see your fleet at once and handle things like fleet firmware updates and being able to use webhooks across the whole fleet. The problem is that if you use the mobile apps to set Wi-Fi, create an account, and claim the device, it creates a developer device, not a product device. For this to work, then every created account would have to be a product team member, which would grant your test customers access to the console for your product, which is probably not what you want.

In your case, it might still be worthwhile to get the device setup SDK working, because using the Device Setup SDK can either set the Wi-Fi and leave the device unclaimed, or create a customer account, which allows the mobile app access to limited APIs specific to their device, while keeping the device part of a product so you maintain control over the fleet of devices.

I don’t have an exact timeline on the P2 device setup example app.

Answer to my own question: In addition to adding
implementation ‘io.particle:cloudsdk:1.0.1’
to the dependencies in build.gradle, also remember to add a reference to the library in the repositories in settings.gradle:
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url ‘https://mvnrepository.com/artifact/io.particle/cloudsdk’}
}

1 Like