简体   繁体   English

在Android AWS中创建新的唯一ID

[英]Create a newly unique id in android AWS

So I am trying to create a new table in AWS dynamoDB, but I cannot find anywhere in the documentation that shows how to create a unique ID for android. 因此,我试图在AWS dynamoDB中创建一个新表,但是在文档中找不到任何显示如何为Android创建唯一ID的文档。 They show how to get the user cognito ID: AWSMobileClient.defaultMobileClient().getIdentityManager().getCachedUserID() , But I am not creating a new user here, I am creating a new Group, so I want a completely unique ID for every table that I create. 它们显示了如何获取用户的认知ID: AWSMobileClient.defaultMobileClient().getIdentityManager().getCachedUserID() ,但是我不是在这里创建新用户,而是在创建新组,因此我希望每个用户都拥有一个唯一的ID我创建的表。 Does anyone know how I can do this? 有人知道我该怎么做吗? I have scoured the internet for this but can't seem to find the answer. 我已经在网上搜寻了此内容,但似乎找不到答案。 The answer in objective-c is very simple, which is found using this: [AWSIdentityManager defaultIdentityManager].identityId; Objective-c中的答案非常简单,可使用以下方法找到: [AWSIdentityManager defaultIdentityManager].identityId; , please tell me there is something like this for the android version. ,请告诉我android版本有类似的内容。 Your help is greatly appreciated. 非常感谢您的帮助。

Figured it out. 弄清楚了。 Had to go into my GroupsDO model and add @DynamoDBAutoGeneratedKey above the groupId section, and it would automatically generate a unique id on save. 不得不进入我的GroupsDO模型并在groupId部分上方添加@DynamoDBAutoGeneratedKey,它将在保存时自动生成唯一的ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM