Is PRODUCT_ID exposed for mobile app device list filtering?

If you’re customizing say the Tinker app for a specific product, is it possible on the device list screen in Tinker to determine the PRODUCT_ID of each device (and then filter only the product ID that the app is customized for)?

I can see the “ID” in Tinker, but I’m talking about the PRODUCT_ID for an organization with a fleet of devices.

I’m assuming the workaround may involve something like each device needs to add a cloud variable with product ID (or another identifier), but then if you have 20 devices the mobile app will need to query every device’s cloud variables. And ideally, even when the device is not connected the mobile app will know which ones belong to show in the list.

No, because the normal mode of operation is to use the Device Setup SDK to communicate with a device, and typically each mobile app works with a single product, so the product ID is hardcoded into the app.

For example, in iOS it’s set using the productId key in the dictionary.

If you’re making some sort of app that’s able to control multiple products, then you’ll either need to use a variable solution like you proposed, or maintain a mapping of device IDs to product Id, either within the app itself, or on your own server.

1 Like

Thanks @rickkas7! Thus far I’ve only used the cloud SDK (and relied on the Particle account/claiming happening outside my app). I’ve just started looking at the Setup SDK and this is a helpful pointer.

I’m starting with Android first before iOS. Maybe I’ll find it once starting, but I don’t see the Android Setup SDK mentioning anything about the product creator product mode?

The Android app has the same customization as the iOS app, and it’s done typically by adding a resource file with your settings. Here’s an example that uses simple auth with a product:

Enabling product mode

In app > res > values > customization.xml, create a new file and add the following:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="productMode">true</bool>
    <integer name="product_id">1319</integer>
    <string name="oauth_client_id">tempmon04-4338</string>
    <string name="oauth_client_secret">460edfd8d71742dd1f1e75c3d5cac5973351465d</string>
    <string name="http_log_level">HEADERS_AND_ARGS</string>
</resources>
2 Likes

Thank you @rickkas7! I love the improved level of support in the forum from Particle employees (and as always the community)!

This was the kind of question I was worried would go unanswered since few community members may venture to this aspect. I have lots of studying up to do on Authentication and Setup SDK but this really helps to point me in the right direction.

1 Like