Warning | ||
---|---|---|
| ||
If you are testing on an emulator - set the target of the emulator to Google APIs |
AnchorPush Manager Push Manager
Push Manager
Push Manager | |
Push Manager |
...
PushManager.init(getApplicationContext(), "YOUR GOOGLE PROJECT NUMBER", "YOUR PUSHAPPS APP TOKEN");
Info |
---|
If you want to set your own Custom Id , set it before calling to init(), as seen here . |
public static PushManager getInstance(Context context) | ||
---|---|---|
Type | Name | Description |
Context | context | The context in which the PushManager instance is initiated. It is recommended to pass your application context. |
...
Anchor | ||||
---|---|---|---|---|
|
...
...
1 2 | PushManager mPushManager = PushManager.getInstance(getApplicationContext()); String registrationId = mPushManager.getDeviceRegistrationId(); |
Custom Id
Anchor | ||||
---|---|---|---|---|
|
Add a custom id to a device, it allows you to have another id for the device alongside the unique device id. If you want to use this feature, call this method before calling the init(Context, String,String) method
public void setCustomID setCustomId(String id, Context context) | ||
---|---|---|
Type | Name | Description |
String | id | the custom id for the user |
Context | context |
public String | getCustomIDgetCustomId( | Context context) |
---|---|---|
Type | Name | Description |
Context | context | No parameters. |
Set the custom Id before calling init() or register.
1 2 | PushManager.setCustomIDsetCustomId("123432",getApplicationContext()); PushManager.init(getApplicationContext(), GOOGLE_API_PROJECT_NUMBER, PUSHAPPS_APP_TOKEN); |
AnchorApp version App version
App version
App version | |
App version |
...
1 2 3 4 5 | PushManager mPushManager = PushManager.getInstance(getApplicationContext()); // retrive the device ID String deviceId = mPushManager.getDeviceId(); |
Anchor | ||||
---|---|---|---|---|
|
You can choose which identifier will be used as the device id.
The default is the device's IMEI if it accessible, but this means you will need to add the android.permission.READ_PHONE_STATE permission in the AndroidManifest.xml file.
use this method to select your desired source for the device id property
Warning |
---|
You must call this method before calling init(Context,String,String) for the first time, since init(Context,String,String) will register the device in our service and if change the id type later the device will be duplicated in our service. Furthermore, once choosing the identifier type it is obviously recommended to never change it again. |
public void setDeviceIDType(DeviceIDTypes type) | ||
---|---|---|
Type | Name | Description |
DeviceIdTypes | type | the desired source for the device id property |
...