Giter Site home page Giter Site logo

inbeaconsdk-android's Introduction

Documentation

Read the full documentation

Getting started

Minimal implementation of the inBeacon SDK in an Android Studio project

Get the SDK from JCenter (recommended)

Add JCenter and the inbeacon repository to your build file's list of repositories:

    repositories {
        jcenter()
        maven { url "https://dl.bintray.com/inbeacon/maven" }
    }

then include

dependencies {
	compile('com.inbeacon:android.sdk:2.+@aar'){ transitive = true }
}

to your gradle dependencies.

Create an Application class

You need to create your own application class to enable working with the inBeacon SDK.

You can't initialize in an activity: the SDK will not work correctly in the background in this case

In this class, initialize the inBeacon SDK from the onCreate of the application:

import android.app.Application;
import com.inbeacon.sdk.InbeaconManager;
import java.util.HashMap;

public class myApp extends Application {

   @Override
	public void onCreate() {

       super.onCreate();

		// initialize with your ClientID and Secret.
		InbeaconManager.initialize(this, "<<your client Id>>", "<<client Secret>>");

   }
}

You can find your client-ID and client-Secret in your account overview

Now you have to make sure MyApp is used as the application class by adding it to your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.inbeacon.inbeaconsdktest" >
    <application android:name=".MyApp">  <!-- add android:name -->
		...
    </application>
</manifest>

ask permission to use location

You also need to ask the user permission to use the device FINE_LOCATION. For convenience, the inBeacon SDK contains a method askPermissions to do this.

for SDK 23 and up only, but works in any SDK

Include this statement in your main activity:

public class MyActivity extends Activity  { 
@Override
protected void onCreate(Bundle savedInstanceState) {
		...
		InbeaconManager.getInstance().askPermissions(this);
		...

For details read the full documentation or check out the Example

inbeaconsdk-android's People

Contributors

inbeacon avatar koenpunt avatar rvwoens avatar

Watchers

 avatar  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.