Socket
Socket
Sign inDemoInstall

@ptomasroos/react-native-idfa

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ptomasroos/react-native-idfa

Android and iOS module to read IDFA


Version published
Weekly downloads
11
increased by1000%
Maintainers
1
Install size
98.6 kB
Created
Weekly downloads
 

Readme

Source

react-native-idfa

How to install

npm install @ptomasroos/react-native-idfa
react-native link

Since this library is using the advertising identifier, you must remember to add AdSupport in your IOS project.

Add AdSupport.framework under "Link Binary With Libraries".

How to use!

import { IDFA } from '@ptomasroos/react-native-idfa';

class Basic extends Component {
  state = {
     IDFA: '',
  };

  componentDidMount() {
    IDFA.getIDFA().then((idfa) => {
      this.setState({ IDFA: idfa, });
    })
    .catch((e) => {
      console.error(e);
    });
  }

  render() {
    return (
      <View style={{ flex: 1 }}>
        <Text>Your IDFA is : {this.state.IDFA}</Text>
      </View>
    );
  }
}

How to run example

git clone git@github.com:ptomasroos/react-native-idfa.git
cd react-native-idfa/examples/Basic
npm install
npm run start

Open simulators and see your IDFA

Changing react-native-idfa's com.google.android.gms:play-services-ads version

In your build.gradle make sure to force the ersion to whatever version makes sense through our your dependencies

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.getRequested().getGroup() == 'com.google.android.gms') {
            // If different projects require different versions of
            // Google Play Services it causes a crash on run.
            // Fix by overriding version for all projects.
            details.useVersion('17.0.0')
        }
    }
}

Keywords

FAQs

Last updated on 25 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc