0

I want to write a webservice that will upload a file to our server in chunks. In c# this would look something like this:

[WebMethod]
void UploadFile(string originalFilename, byte[] chunk, int numChunks)
{
    //once: create folder based on unique android device id...
    //once: create file with original filename's extension
    //append chunk
    //chunkCount++;
    //once: if chunkCount == numChunks then file is complete
}

I have toy'd with a couple ideas for how to uniquely identify the device the incoming chunk is from.

  1. by ip adress, the downside to this as far as I know is a bad idea. I assume when the phone changes ip when it switches between radios.
  2. send a unique identifier... mac address kind of falls under the same category as above, and I heard ANDROID_ID is not unique enough.

anyone got any ideas?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Tom Fobear
  • 6,729
  • 7
  • 42
  • 74

1 Answers1

3

The question for a unique identifier has already been asked and answered here. I suppose that ANDROID_ID will work in 99% of the phones.

If you need a bullet proof solution create a registration scheme. Create a web method that will return a unique identifier you will somehow create. Store this in the device's preferences. Leave the field blank initially. When the application is used for the first time, your application will call this method and get a unique identifier.

Also, this may raise ethical issues for your application. You need to at least inform your users that you are collecting anonymous data regarding the use of the application and ask for their consent.

Community
  • 1
  • 1
kgiannakakis
  • 103,016
  • 27
  • 158
  • 194