@amos-sdk/react-native
v2.0.12
Published
React Native core bindings and hooks for AMOS monetization decisions, events, and metrics.
Readme
AMOS React Native Core
Core React Native bindings for AMOS decisions, event tracking, and metric tracking.
Use this package when the app does not want AMOS to own an ad-network wrapper.
import { AmosProvider, useAmos } from '@amos-sdk/react-native';
export function Root() {
return (
<AmosProvider
config={{
apiKey: 'AMOS_API_KEY',
appId: 'app_example',
userId: 'publisher-user-123',
lifecycle: {
automatic: true,
sessionTimeoutSeconds: 1800,
configRefreshIntervalSeconds: 300,
},
}}
>
<App />
</AmosProvider>
);
}
function ExampleButton() {
const amos = useAmos();
return <Button title="Track" onPress={() => amos.trackEvent('feature_used')} />;
}The lifecycle block is optional; the values above are the defaults. Android lifecycle handling is automatic, so do not add an AppState listener that ends the AMOS session. Use amos.refreshConfiguration() only when an immediate refresh is needed for QA or a critical policy change.
The Android wrapper resolves the core Maven artifact from this package's amosSdkVersion field:
implementation("com.yuktinai:amos-sdk:<amosSdkVersion>")For AMOS-managed AdMob load/show APIs, install @amos-sdk/react-native-admob instead.
The native package namespace remains com.yuktinai.amos... for Android compatibility.
