While developing an IoT device integration with Android app I'm stuck at this problem.
What I wish to achieve is to talk to my app, for example, "Alexa, What is the temperature inside the cooker?". For this info to retrieve, I have an android app connected to smart cooker via bluetooth and the app than can read the temperature info from cooker.
Now how do I get the query in my android app and how can I return my response as "The current temperature in cooker is 100 degree celsius". and alexa could verbalize it for me.
Here is what I've done so far.
1. I created an account with amazon developer console
2. Registered my app there and copied API key into my android project
3. Added their lib in my android project
4. Used Login With Amazon service to get the `accessToken`
requestContext = RequestContext.create(this) requestContext.registerListener(object : AuthorizeListener() { override fun onSuccess(authorizeResult: AuthorizeResult) { accessToken = authorizeResult.accessToken Timber.d("Access Token: %s", accessToken) } override fun onCancel(auth: AuthCancellation?) { Timber.e(auth?.description) } override fun onError(error: AuthError) { Timber.e(error, error.localizedMessage) } }) signInBtn.setOnClickListener { AuthorizationManager.authorize( AuthorizeRequest.Builder(requestContext) .addScopes(ProfileScope.profile(), ProfileScope.postalCode()) .build() ) }
Here is the manifest's relevant declarations
<activity android:name="com.amazon.identity.auth.device.workflow.WorkflowActivity" android:theme="@android:style/Theme.NoDisplay" android:allowTaskReparenting="true" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <!-- android:host must use the full package name found in Manifest General Attributes --> <data android:host="${applicationId}" android:scheme="amzn"/> </intent-filter> </activity>
I've been following this documentation.
What do I have to do to get the query in my application to process and return the result? or is it possible at all?