fix(Connectivity): androidApp is not defined on SDK <28 (#10324)

fixes #10323

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>
This commit is contained in:
Igor Randjelovic
2023-06-23 18:18:51 +02:00
committed by GitHub
parent 029ed4fe5d
commit fce2e88cba
2 changed files with 3 additions and 4 deletions

View File

@ -109,8 +109,7 @@ function startMonitoringLegacy(connectionTypeChangedCallback) {
connectionTypeChangedCallback(newConnectionType);
};
const zoneCallback = zonedCallback(onReceiveCallback);
// @ts-ignore
androidApp.registerBroadcastReceiver(android.net.ConnectivityManager.CONNECTIVITY_ACTION, zoneCallback);
Application.android.registerBroadcastReceiver(android.net.ConnectivityManager.CONNECTIVITY_ACTION, zoneCallback);
}
let callback;

View File

@ -103,7 +103,7 @@ declare module globalThis {
function _isModuleLoadedForUI(moduleName: string): boolean;
var onGlobalLayoutListener: any;
function zonedCallback(callback: Function): Function;
function zonedCallback<T = Function>(callback: T): T;
var Reflect: any;
function Deprecated(target: Object, key?: string | symbol, descriptor?: any): any;
function Experimental(target: Object, key?: string | symbol, descriptor?: any): any;
@ -358,7 +358,7 @@ declare function fail(data: any): void;
*/
// declare function clearInterval(id: number): void;
declare function zonedCallback(callback: Function): Function;
declare function zonedCallback<T = Function>(callback: T): T;
/**
* Create a Java long from a number