Skip to content

Instantly share code, notes, and snippets.

@roblav96
Created September 27, 2016 22:13
Show Gist options
  • Select an option

  • Save roblav96/b05fb93c89503fe75b2f4bb997657ff6 to your computer and use it in GitHub Desktop.

Select an option

Save roblav96/b05fb93c89503fe75b2f4bb997657ff6 to your computer and use it in GitHub Desktop.
@JavaProxy('com.tns.NativeScriptActivity')
class Activity extends android.app.Activity {
private _callbacks: frame.AndroidActivityCallbacks
onCreate(savedInstanceState: android.os.Bundle): void {
if (!this._callbacks) {
(<any>frame).setActivityCallbacks(this)
}
this._callbacks.onCreate(this, savedInstanceState, super.onCreate)
}
onRequestPermissionsResult(requestCode: number, permissions: Array<String>, grantResults: Array<number>): void {
/*===========================================================================================
= I DIDNT KNOW CALLING super.onRequestPermissionsResult WAS MANDATORY =
===========================================================================================*/
this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, super.onRequestPermissionsResult)
}
onNewIntent(intent: android.content.Intent): void {
let data: string = intent.getDataString()
if (typeof data == 'string') {
let url: Url = parse(data, true)
LifeService.getEmitter().emit('url', url)
}
super.onNewIntent(intent)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment