-2

Hi can anyone one suggest me a primary key(type:long) implementation which is for each installed android application. This will help me much. Checked below link. But it will return type string. Identifying-app-installations

Thanks in advance.

Madhukar
  • 5
  • 6
  • Can i get the reason for downvoting? – Madhukar Feb 09 '15 at 06:34
  • maybe you got downvote because there's no way to generate a random UUID in type:long. if you want, you can generate your UUID contain only number using random() method – Randyka Yudhistira Feb 09 '15 at 06:42
  • Nothing is impossible. I did by converting string to char and char to long. Still it is little big.But if anyone is having good solution then it would help me a lot :). – Madhukar Feb 09 '15 at 06:47
  • when you use UUID to generate random UUID, it will generate like this one `123e4567-e89b-12d3-a456-426655440000`. there's no way you put not number element into long type – Randyka Yudhistira Feb 09 '15 at 06:50
  • Thanks for the info. i did like taking android application package name like com.package.name as "String" then do String->Char->long you will get unique ID for each application. – Madhukar Feb 09 '15 at 06:51
  • What is the problem and what does sqlite primary key have to do with it? – laalto Feb 09 '15 at 07:20
  • I have to store each individual application details in sql lite. Like - Name,InstalledOn,DataUsage,TotalSize.here i am updating data usage for each hour/day etc. for that i need a primary key. – Madhukar Feb 09 '15 at 07:41

1 Answers1

0

long is a 64-bit type, but there are more than 264 possible application IDs. This is not possible.

Just use the string as primary key.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Just referred this. http://stackoverflow.com/questions/20094992/greendao-string-primary-keys-how-to-use Thanks CL. – Madhukar Feb 10 '15 at 09:35