Git Product home page Git Product logo

profiler-sdk-demo's Introduction

42matters Profiler SDK for Android

42matters profiler sdk (beta) delivers insights about Android users based on the apps they have. The sdk has a tiny footprint under 40k, and the integration requires only several lines of code. There’s also no dubious permissions required other than accessing internet and networks states.

Demo

This repo demonstrated how to integrate profiler sdk. The app is built with Android Studio.

If you simply want to check out what 42matters profiler would infer about you, try the Google Play Version

How to integrate in your app

Prerequisites

  • Your app has a minimum sdk level of 10 (Android 2.3.3+).
  • You registered your app on the https://42matters.com/profiler/, and you have its app id.
  • The app's status is ON.

Integrate the library

  1. Download and reference it or put the following repository and dependency in your build.gradle:
repositories {
    maven {
        url "http://dl.bintray.com/42matters/android"
    }
    ...
}

dependencies {
    compile 'com.core42matters.android:profiler:1.1.0-beta@jar'
    ...
}
  1. Configure your app's AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
  ...
  <!-- Permissions -->
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

  <application ... >
  	...
  	<!-- You app id  -->
  	<meta-data
  		android:name="42:appid"
  		android:value="YOUR_APP_ID" />
  </application>

</manifest>
Replace **YOUR_APP_ID** with the app id you get on your app page
  1. If you use proguard, add these into your proguard-rules.pro if your app does not use Google Play Services
-dontwarn com.google.android.gms.**
  1. Call Profiler.getProfile(Context context) to get the inferred profile about the user installed your app. This call returns immediately and start a background thread to fetch the profile if none is cached locally.

Privacy

You need to provide a preference in the default shared preferences for users to opt out at any time. The default key to use is com.core42matters.android.profiler.personalized. This demo also shows how to implement this in the preferences.

What's inside a profile (1.1.0-beta)

Gender

profile.isMale() and profile.isFemale() tells the inferred gender. It could happen both of them return false, when we are not confident about our prediction for example.

Interests

profile.getInterests() would return a List<String> containing the interests of this user we predict.

The 1.1.0-beta supports following interests:

  • Auto enthusiasts
  • Beauty
  • Books
  • Comics
  • Commuting
  • Cooking
  • Dieting
  • Education
  • Fashion
  • Finance
  • Fitness
  • Gastronomy
  • Health
  • Job market
  • Medical
  • Movies
  • Music consumption
  • News
  • Photography
  • Pregnancy
  • Productivity
  • Real Estate
  • Running
  • Singles
  • Sports activity
  • Sports entertainment
  • Techies
  • Traveling
  • Value shopper

Interested in deals, coupons and price comparison

Use AdMobPlugin to decorate an ad request

You could use our AdMobPlugin to attach inferred profile to an AdMob ad request to increase the chance getting better targeted ads.

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  ...
  AdView adView = (AdView) findViewById(R.id.adView);
  adView.loadAd(AdMobPlugin.buildRequest(this));
  ...
}

Alternatively, you could use AdMobPlugin.decorate(Context context, AdRequest.Builder builder) to finish your request building.

Calls to Profiler are done within the AdMobPlugin, so you do not have to call them explicitly.

Contact us

If you have any questions when implementing these, feel free to drop us an email.

License

Copyright 2014 42matters AG.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

profiler-sdk-demo's People

Contributors

wang2bo2 avatar

Watchers

emiliano avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.