Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adobe AIR - How to get Device ID of Android and iOS?

Participant ,
Apr 30, 2017 Apr 30, 2017

Dear All,

In my project I want to get the user's device ID (Android or iPad whatever he use) whenever he install the app. How can I get it using AS 3.0 in AIR? Please suggest and help me.

Thanks in advance,

Guru

TOPICS
ActionScript
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2017 Apr 30, 2017

i don't think you can, nor is is necessary.  what reason would you have to access that?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 01, 2017 May 01, 2017

Hi kglad,

Thanks for your reply.

The reason is, we need to restrict the user to access the app from a particular device. Please let me know if any suggestion.

Thanks,

Guru

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2017 May 01, 2017

i don't understand that.

are you saying each user can install on only one of their devices?  are you saying that only certain udid's are allowed?  something else?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 01, 2017 May 01, 2017

Similarly. The scope is, user should not use multiple device at the same time. Example, if the user installed app in iPad today and he install the same in some other device tomorrow and login, we should tell them that you are trying to access your account from different device and you may lost your previous data (Because we are using local db to store some values and update them when ever he connect net) something like that. So that we need the device ID. Please suggest.

Thanks in advance,

Guru

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2017 May 02, 2017

I think you can do what you need without the device ID, and you can't do what you described with the device ID. To know that a user who is logging in has also used a different device would require an online database to keep a list of each registered user's devices. If you're going to have a database to store the device IDs you may as well use it for storing data.

But say you stick with just a sharedobject, when the user opens the app you can tell that there is no shareobject, and could tell the user that the data is device specific, and that any work done on other devices won't show up. You wouldn't need the device ID to work that way.

There is a slight complication if you intend on publishing with Amazon. With them there is a requirement to pass sharedobject data to other devices on the same account. That's achieved by using Amazon's own version of sharedobject. You can still work in the way I suggested, because when an Amazon user does open the app on a different device they will be given the sharedobject from the other device. Which means if you did check the device ID and somehow know that they have been using a different device, you would be wrong is saying that they don't get the data from the other device.

Now, it could be you're using a different kind of database, where the data is always just on that one device. If that's the case then you just wouldn't be able to publish to Amazon.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 02, 2017 May 02, 2017

using a server database would solve your problems.  otherwise, i don't see any way to prevent one user having multiple databases.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 02, 2017 May 02, 2017

Thank you very much Colin and kglad,

I think I need to explain with more clarity what is the actual requirement. Here it is.

Once the user buy the app and installed in his device, he/she can play in it offline. There is a chance, the user can give his/her login details to many people and they can use it without buy the app. So, if we get his/her device id while install the app, we can monitor whether the same user is accessing the content or any others from different devices when the net is connected and can prevent it. So, I think by store the user's device id will help to do that. Any other better idea or logic? please suggest.

Thanks is advance,

Guru

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2017 May 03, 2017

that doesn't make sense.  what are you using to determine if someone pays?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 03, 2017 May 03, 2017

HI kglad,

Have a good day!

This is what client requirement .

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 03, 2017 May 03, 2017

I think that reading the user's device ID may not work out, but you could generate a number the first time the user signs in. The app could do that or the server could, but the number would be stored both locally and in the server.

Any other time they try to log in the number would be checked. For that one user it would match, but anyone else who installed the app would get a different number when the app is first used, and so would fail the match.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 03, 2017 May 03, 2017

Hi Colin,

Have a good day!

Nice solution. I also thought in that way before. But, small difficult is there. If the user uninstalled the app and reinstall the same, the previous generated number also won't be there and the app will generate new number and will check with the server. Obviously that wouldn't match at all. So, the user can't access the content after reinstalled in the same device too. Is there any better way? Please suggest.

Thanks,

Guru

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 05, 2017 May 05, 2017

One of the reasons we've offered alternate approaches is because Apple don't allow apps to read the UDID of a device. It is possible to get the user to install a provisioning profile that they makes it possible, but that would be a slightly ugly start of using your app, and you may need to explain to the user why you need the UDID.

But, there is this ANE:

GitHub - myflashlab/UDID-ANE: Use this AIR Native Extension to obtain a unique device ID in your Ado...

It can give you the UUID on Android, and the vendor ID on iOS. I imagine the vendor ID is what AT&T gives the device.

Maybe that will be unique enough for your purposes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 06, 2017 May 06, 2017
LATEST

Hi Colin,

Have a Good day!

Excellent. I will try using ANE and let you know the status soon.

Thanks a lot my dear friend .

Guru

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines