DeviceRegistrar.java
2.79 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.arellomobile.android.push;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.arellomobile.android.push.request.RegisterDeviceRequest;
import com.arellomobile.android.push.request.RequestManager;
import com.arellomobile.android.push.request.UnregisterDeviceRequest;
import com.arellomobile.android.push.utils.PreferenceUtils;
import com.google.android.gcm.GCMRegistrar;
import java.util.Date;
public class DeviceRegistrar
{
static void a(Context paramContext, String paramString)
{
Log.w("DeviceRegistrar", "Registering for pushes");
RegisterDeviceRequest localRegisterDeviceRequest = new RegisterDeviceRequest(paramString);
try
{
RequestManager.sendRequest(paramContext, localRegisterDeviceRequest);
GCMRegistrar.setRegisteredOnServer(paramContext, true);
PushEventsTransmitter.a(paramContext, paramString);
PreferenceUtils.setLastRegistration(paramContext, new Date().getTime());
Log.w("DeviceRegistrar", "Registered for pushes: " + paramString);
return;
}
catch (Exception paramString)
{
if (paramString.getMessage() != null)
{
PushEventsTransmitter.b(paramContext, paramString.getMessage());
Log.e("DeviceRegistrar", "Registration error " + paramString.getMessage(), paramString);
return;
}
paramString = localRegisterDeviceRequest.getRawResponse();
Log.e("DeviceRegistrar", "Registration error " + paramString);
PushEventsTransmitter.b(paramContext, paramString);
}
}
static void b(Context paramContext, String paramString)
{
Log.w("DeviceRegistrar", "Try To Unregistered for pushes");
GCMRegistrar.setRegisteredOnServer(paramContext, false);
UnregisterDeviceRequest localUnregisterDeviceRequest = new UnregisterDeviceRequest();
try
{
RequestManager.sendRequest(paramContext, localUnregisterDeviceRequest);
PushEventsTransmitter.c(paramContext, paramString);
Log.w("DeviceRegistrar", "Unregistered for pushes: " + paramString);
PreferenceUtils.resetLastRegistration(paramContext);
return;
}
catch (Exception paramString)
{
if (!TextUtils.isEmpty(paramString.getMessage()))
{
PushEventsTransmitter.d(paramContext, paramString.getMessage());
Log.e("DeviceRegistrar", "Unregistration error " + paramString.getMessage(), paramString);
return;
}
paramString = localUnregisterDeviceRequest.getRawResponse();
PushEventsTransmitter.d(paramContext, paramString);
Log.e("DeviceRegistrar", "Unregistration error " + paramString);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/DeviceRegistrar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/