package com.xamoom.android.xamoom_android_sdk_app;

import android.app.Application;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v7.app.NotificationCompat;
import android.util.Log;

import com.xamoom.android.XamoomBeaconService;

/**
 * Created by raphaelseher on 08.10.15.
 */
public class XamoomAndroidApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        XamoomBeaconService.getInstance(getApplicationContext()).startBeaconService("5704");
        XamoomBeaconService.getInstance(getApplicationContext()).automaticRanging = true;
        XamoomBeaconService.getInstance(getApplicationContext()).approximateDistanceRanging = true;

        //only place to do things, when scanning in background
        registerReceiver(mEnterRegionBroadCastReciever, new IntentFilter(XamoomBeaconService.ENTER_REGION_BROADCAST));
        registerReceiver(mExitRegionBroadCastReciever, new IntentFilter(XamoomBeaconService.EXIT_REGION_BROADCAST));
    }

    private final BroadcastReceiver mEnterRegionBroadCastReciever = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Log.d("XamoomBeaconService", "background: enterRegion");

            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext());
            notificationBuilder
                    .setContentText("Öffne um etwas zu Entdecken.")
                    .setContentTitle("xamoom in der Nähe")
                    .setContentInfo("Beacon")
                    .setSmallIcon(R.drawable.ic_xamoom_ble)
                    .setNumber(1);
            Notification notification = notificationBuilder.build();

            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplicationContext());
            notificationManager.notify(1, notification);
        }
    };

    private final BroadcastReceiver mExitRegionBroadCastReciever = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Log.d("XamoomBeaconService", "background: exitRegion");
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplicationContext());
            notificationManager.cancel(1);
        }
    };
}

@@ -102,32 +102,66 @@
 p.Notification;%0A
+import android.app.PendingIntent;%0A
 import android.c
@@ -1469,24 +1469,305 @@
 rRegion%22);%0A%0A
+            Intent activityIntent = new Intent(XamoomAndroidApp.this, MainActivity.class);%0A            activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);%0A%0A            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,%0A                    activityIntent, 0);%0A%0A
             
@@ -2137,16 +2137,69 @@
 om_ble)%0A
+                    .setContentIntent(pendingIntent)%0A
         

Add intent to notification