Modify Launcher Activity

Invoke Pushy.listen(this) in your launcher activity's onCreate() method so that Pushy's internal notification listening service will restart itself, if necessary.

Add Below:

Android 6.0+ Compatibility

Skip this if your targetSdkVersion is less than 23.

Android 6.0 and newer versions require apps with a targetSdkVersion >= 23 to explicitly request permissions from users via permission dialogs. Since Pushy persists device tokens in the external storage (to survive app reinstallation), you must add the following code to your app's launcher activity.

Add Below:
// Check whether the user has granted us the READ/WRITE_EXTERNAL_STORAGE permissions
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    // Request both READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE so that the
    // Pushy SDK will be able to persist the device token in the external storage
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);

Warning: If the user doesn't grant your app the WRITE_EXTERNAL_STORAGE permission, and your app continues to call Pushy.register() without storage access, a new device token will be generated after every app reinstallation, which may lead to being billed multiple times for the same device.