Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titlePlease Notice

If you are testing on an emulator - set the target of the emulator to Google APIs

 

Anchor
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)

TypeNameDescription
Context

context

The context in which the PushManager instance is initiated. It is recommended to pass your application context.

...

Icon

If you would like to open a specific view or do some specific action, after the notification was tapped, we do not recommend using this option. Instead, handle it from your main activity, in which all the JSON parameters are available for you. For more information, please see the Handling notification clicks section

Anchor
Custom settings
Custom settings
Custom settings

...

Icon

If you implement this interface, you will also need to build your own notification view. If you do not want to handle it yourself, and you prefer the default view that the PushApps SDK supplies, you can just call our buildNotification method, which will do it for you. For more information, please refer to the Custom Notification View section.

...

 

1
2
PushManager mPushManager = PushManager.getInstance(getApplicationContext());
String registrationId = mPushManager.getDeviceRegistrationId();

Custom Id 
Anchor
Custom Id
Custom Id

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)

TypeNameDescription
String

id

the custom id for the user

Contextcontext 
getCustomIDContext context

public String

getCustomId(

)

TypeNameDescription
ContextcontextNo 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);

Anchor
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
Device Id types
Device Id types
Device Id types

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)

TypeNameDescription
DeviceIdTypes

type

the desired source for the device id property

 

...