MCPcopy Index your code
hub / github.com/NativeScript/firebase / register

Function register

packages/firebase-messaging-core/index.android.ts:97–117  ·  view source on GitHub ↗
(args: any)

Source from the content-addressed store, hash-verified

95const _permissionQueue: { resolve: Function; reject: Function }[] = [];
96
97function register(args: any) {
98 if (!lastActivity) {
99 // Some activities do not implement activity result API
100 if (args.activity.registerForActivityResult) {
101 lastActivity = new WeakRef(args.activity);
102 requestPermissionLauncher = args.activity.registerForActivityResult(
103 new androidx.activity.result.contract.ActivityResultContracts.RequestPermission(),
104 new androidx.activity.result.ActivityResultCallback({
105 onActivityResult(isGranted: boolean) {
106 _permissionQueue.forEach((callback) => {
107 callback.resolve(isGranted ? 0 : 1);
108 });
109 _permissionQueue.splice(0);
110 },
111 })
112 );
113 } else {
114 Application.android.once('activityCreated', register);
115 }
116 }
117}
118
119Application.android.on('activityResumed', (args) => {
120 MessagingCore._inForeground = true;

Callers

nothing calls this directly

Calls 1

onceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…