forked from organicmaps/organicmaps
[AND] FB Integration.
[AND] Build for 19 API.
This commit is contained in:
parent
596b41fc75
commit
34c74e7d6c
7 changed files with 69 additions and 0 deletions
4
android/MapsWithMeLite/res/values/fb.xml
Normal file
4
android/MapsWithMeLite/res/values/fb.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="fb_app_id">272257082798521</string>
|
||||
</resources>
|
4
android/MapsWithMePro/res/values/fb.xml
Normal file
4
android/MapsWithMePro/res/values/fb.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="fb_app_id">185237551520383</string>
|
||||
</resources>
|
|
@ -11,3 +11,4 @@
|
|||
target=android-19
|
||||
android.library=true
|
||||
android.library.reference.1=3rd_party/HoloEverywhere/library
|
||||
android.library.reference.2=3rd_party/facebook-android-sdk/facebook
|
||||
|
|
4
android/res/values/fb.xml
Normal file
4
android/res/values/fb.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="fb_app_id">NOT_REALLY_KEY</string>
|
||||
</resources>
|
|
@ -398,6 +398,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
mApplication = (MWMApplication)getApplication();
|
||||
mApplication.OnMwmStart(this);
|
||||
|
||||
final boolean isPro = mApplication.isProVersion();
|
||||
if (checkLiteProPackages(isPro))
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
|
@ -21,6 +22,7 @@ import com.mapswithme.maps.guides.GuidesUtils;
|
|||
import com.mapswithme.maps.location.LocationService;
|
||||
import com.mapswithme.maps.state.AppStateManager;
|
||||
import com.mapswithme.maps.state.SuppotedState;
|
||||
import com.mapswithme.util.FbUtil;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
|
||||
|
@ -305,4 +307,9 @@ public class MWMApplication extends android.app.Application implements MapStorag
|
|||
|
||||
public native double nativeGetDouble(String name, double defaultValue);
|
||||
public native void nativeSetDouble(String name, double value);
|
||||
|
||||
public void OnMwmStart(Context context)
|
||||
{
|
||||
FbUtil.activate(context);
|
||||
}
|
||||
}
|
||||
|
|
48
android/src/com/mapswithme/util/FbUtil.java
Normal file
48
android/src/com/mapswithme/util/FbUtil.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.AppEventsLogger;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.SimpleLogger;
|
||||
|
||||
|
||||
|
||||
public class FbUtil
|
||||
{
|
||||
|
||||
public static Logger mLogger = SimpleLogger.get("MWM_FB");
|
||||
|
||||
public final static String[] SUPPORTED_PACKAGES = {
|
||||
"com.mapswithme.maps",
|
||||
"com.mapswithme.maps.pro",
|
||||
};
|
||||
|
||||
public static void activate(Context context)
|
||||
{
|
||||
final String thisPackageName = context.getPackageName();
|
||||
|
||||
boolean supported = false;
|
||||
for (final String pkg : SUPPORTED_PACKAGES)
|
||||
{
|
||||
if (pkg.equals(thisPackageName))
|
||||
{
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// do not try to activate if package is not registered in FB
|
||||
if (!supported)
|
||||
{
|
||||
mLogger.d("SKIPPING ACTIVATION");
|
||||
return;
|
||||
}
|
||||
|
||||
mLogger.d("ACTIVATING");
|
||||
AppEventsLogger.activateApp(context, context.getString(R.string.fb_app_id));
|
||||
}
|
||||
|
||||
private FbUtil() {};
|
||||
}
|
Loading…
Add table
Reference in a new issue