LinkActivityHelper
Helper with functions to request the distributor's link activity for result and process the result
Usage
In your activity, define a new LinkActivityHelper, override onActivityResult to use onLinkActivityResult then use startLinkActivityForResult to start activity on the distributor.
class MyActivity: Activity() {
/* ... */
private val helper = LinkActivityHelper(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!helper.startLinkActivityForResult()) {
// No distributor found
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (helper.onLinkActivityResult(requestCode, resultCode, data)) {
// The distributor is saved, you can request registrations with UnifiedPush.registerApp now
} else {
// An error occurred, consider no distributor found for the moment
}
}
/* ... */
}
Content copied to clipboard