I need to be able to skip the login screen on the android app. I’m following the documentation and this is what I’m doing right now:
I’m logging the user in to my server with my credentials.
In my server, I’m creating a shadow customer with Particle and sending the access token to my android client.
In my android app, I’m setting the access token using ParticleCloudSDK.getCloud().setAccessToken("ACCESS_TOKEN_HERE", new Date(14614569517535L));
I’m checking ParticleCloudSDK.getCloud().isLoggedIn() and the result is false.
Then, when I start ParticleDeviceSetupLibrary.startDeviceSetup(this); the app shows the Particle Login screen, and not directly the setup wifi screen I want to show.
I’m still getting false when calling ParticleCloudSDK.getCloud().isLoggedIn() after setting the access token.
It now skips the login screen, but when clicking the READY button, it crashes and throws the following error in the stack:
03-15 23:31:05.772 13596-13596/my.sample.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: my.sample.app, PID: 13596
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.sample.app/io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity}: java.lang.IllegalArgumentException: Null value for 'username'
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IllegalArgumentException: Null value for 'username'
at com.squareup.phrase.Phrase.put(Phrase.java:126)
at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity.onCreate(DiscoverDeviceActivity.java:123)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I suspect it has to do with the fact that the customer I registered for my organization from my back-end doesn’t show on dashboard.particle.com. Actually I followed the docs and I noticed that when you create a customer you never specify a product, although the customers in the dashboard are grouped by product, not by organization. This is the exmple I followed: