Documentation

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.

Find:
super.onCreate(savedInstanceState);
Add Below:
Pushy.listen(this);

Android 6.0+ Compatibility


Skip this if your targetSdkLevel is less than 23.

Android 6.0 and newer versions require apps with a targetSdkLevel >= 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.

Find:
Pushy.listen(this);
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);
}