forked from vieux/OpenUDID
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenUDID_service.java
More file actions
37 lines (29 loc) · 960 Bytes
/
OpenUDID_service.java
File metadata and controls
37 lines (29 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.OpenUDID;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Binder;
import android.os.IBinder;
/*
* You have to add this in your manifest
<service android:name="org.OpenUDID.OpenUDID_service">
<intent-filter>
<action android:name="org.OpenUDID.GETUDID" />
</intent-filter>
</service>
*/
public class OpenUDID_service extends Service{
@Override
public IBinder onBind(Intent arg0) {
return new Binder() {
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) {
final SharedPreferences preferences = getSharedPreferences(OpenUDID_manager.PREFS_NAME, Context.MODE_PRIVATE);
reply.writeInt(data.readInt()); //Return to the sender the input random number
reply.writeString(preferences.getString(OpenUDID_manager.PREF_KEY, null));
return true;
}
};
}
}