diff options
-rw-r--r-- | android/AndroidManifest.xml | 50 | ||||
-rw-r--r-- | android/build.gradle | 8 | ||||
-rw-r--r-- | android/proguard-mwm.txt | 6 | ||||
-rw-r--r-- | android/src/com/mapswithme/maps/MwmApplication.java | 26 | ||||
-rwxr-xr-x | configure.sh | 4 |
5 files changed, 92 insertions, 2 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 845c6499ea..e4f5359f39 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -69,6 +69,18 @@ android:name="io.fabric.ApiKey" android:value="${FABRIC_API_KEY}"/> + <meta-data + android:name="PW_APPID" + android:value="${PW_APPID}" /> + + <meta-data + android:name="PW_PROJECT_ID" + android:value="${PW_PROJECT_ID}" /> + + <!--meta-data + android:name="PW_LOG_LEVEL" + android:value="ERROR" /--> + <activity android:name="com.mapswithme.maps.DownloadResourcesActivity" android:configChanges="orientation|screenLayout|screenSize" @@ -333,6 +345,44 @@ </intent-filter> </receiver> + <!-- PushWoosh --> + <activity android:name="com.pushwoosh.richpages.RichPageActivity" /> + <activity android:name="com.pushwoosh.MessageActivity" /> + <activity android:name="com.pushwoosh.PushHandlerActivity" /> + + <receiver + android:name="com.google.android.gms.gcm.GcmReceiver" + android:exported="true" + android:permission="com.google.android.c2dm.permission.SEND" > + <intent-filter> + <action android:name="com.google.android.c2dm.intent.RECEIVE" /> + <category android:name="${applicationId}" /> + </intent-filter> + </receiver> + + <service + android:name="com.pushwoosh.GCMListenerService" + android:exported="false"> + <intent-filter> + <action android:name="com.google.android.c2dm.intent.RECEIVE"/> + </intent-filter> + </service> + + <service + android:name="com.pushwoosh.GCMInstanceIDListenerService" + android:exported="false"> + <intent-filter> + <action android:name="com.google.android.gms.iid.InstanceID"/> + </intent-filter> + </service> + + <service + android:name="com.pushwoosh.GCMRegistrationService" + android:exported="false" /> + + <service + android:name="com.pushwoosh.location.GeoLocationService" /> + <!-- Catches app upgraded intent --> <receiver android:name=".background.UpgradeReceiver"> <intent-filter> diff --git a/android/build.gradle b/android/build.gradle index 8984e14ca6..735d72f983 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -47,6 +47,7 @@ dependencies { // 3-party compile 'com.facebook.android:facebook-android-sdk:4.8.0' compile 'com.google.code.gson:gson:2.6.1' + compile 'com.pushwoosh:pushwoosh:4.1.3' compile fileTree(dir: '3rd_party', include: '*.jar') // BottomSheet compile project(":3rd_party:BottomSheet") @@ -92,6 +93,13 @@ android { props.load(new FileInputStream("${projectDir}/fabric.properties")); manifestPlaceholders = [ 'FABRIC_API_KEY': props['apiKey'] ] buildConfigField 'String', 'FABRIC_API_KEY', /"${props['apiKey']}"/ + + // PushWoosh keys + Properties pwProps = new Properties() + pwProps.load(new FileInputStream("${projectDir}/pushwoosh.properties")); + manifestPlaceholders += [ 'PW_APPID': pwProps['pwAppId'] ] + buildConfigField 'String', 'PW_APPID', /"${pwProps['pwAppId']}"/ + manifestPlaceholders += [ 'PW_PROJECT_ID': pwProps['pwProjectId'] ] } sourceSets.main { diff --git a/android/proguard-mwm.txt b/android/proguard-mwm.txt index 19697678b1..3d114434b2 100644 --- a/android/proguard-mwm.txt +++ b/android/proguard-mwm.txt @@ -12,6 +12,12 @@ -dontwarn okio.** -dontwarn com.facebook.** +# pushwoosh +-keep class com.pushwoosh.** { *; } +-keep class com.arellomobile.** { *; } +-dontwarn com.pushwoosh.** +-dontwarn com.arellomobile.** + # myTarget -dontwarn ru.mail.android.mytarget.** -dontwarn com.mopub.** diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java index 1de77a3e52..61e6622b93 100644 --- a/android/src/com/mapswithme/maps/MwmApplication.java +++ b/android/src/com/mapswithme/maps/MwmApplication.java @@ -1,9 +1,7 @@ package com.mapswithme.maps; import android.app.Application; -import android.content.ComponentName; import android.content.SharedPreferences; -import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Environment; import android.os.Handler; @@ -32,6 +30,8 @@ import com.mapswithme.util.Constants; import com.mapswithme.util.ThemeSwitcher; import com.mapswithme.util.UiUtils; import com.mapswithme.util.statistics.Statistics; +import com.pushwoosh.PushManager; + import io.fabric.sdk.android.Fabric; import net.hockeyapp.android.CrashManager; @@ -39,6 +39,8 @@ public class MwmApplication extends Application { private final static String TAG = "MwmApplication"; + private static final String PW_EMPTY_APP_ID = "XXXXX"; + private static MwmApplication sSelf; private SharedPreferences mPrefs; private AppBackgroundTracker mBackgroundTracker; @@ -102,6 +104,7 @@ public class MwmApplication extends Application initHockeyApp(); initCrashlytics(); + initPushWoosh(); initPaths(); nativeInitPlatform(getApkPath(), getDataStoragePath(), getTempPath(), getObbGooglePath(), @@ -224,6 +227,25 @@ public class MwmApplication extends Application System.loadLibrary("mapswithme"); } + private void initPushWoosh() + { + try + { + if (BuildConfig.PW_APPID.equals(PW_EMPTY_APP_ID)) + return; + + PushManager pushManager = PushManager.getInstance(this); + + pushManager.onStartup(this); + pushManager.registerForPushNotifications(); + pushManager.startTrackingGeoPushes(); + } + catch(Exception e) + { + Log.e("Pushwoosh", e.getLocalizedMessage()); + } + } + public void initCounters() { if (!mAreCountersInitialized) diff --git a/configure.sh b/configure.sh index 2bada00f25..78da54d36f 100755 --- a/configure.sh +++ b/configure.sh @@ -8,6 +8,7 @@ BASE_PATH=`dirname "$0"` PRIVATE_HEADER="$BASE_PATH/private.h" PRIVATE_PROPERTIES="$BASE_PATH/android/secure.properties" PRIVATE_FABRIC_PROPERTIES="$BASE_PATH/android/fabric.properties" +PRIVATE_PUSHWOOSH_PROPERTIES="$BASE_PATH/android/pushwoosh.properties" SAVED_PRIVATE_REPO_FILE="$BASE_PATH/.private_repository_url" TMP_REPO_DIR="$BASE_PATH/.tmp.private.repo" @@ -59,6 +60,9 @@ else echo 'apiSecret=0000000000000000000000000000000000000000000000000000000000000000 apiKey=0000000000000000000000000000000000000000 ' > "$PRIVATE_FABRIC_PROPERTIES" + echo 'pwAppId=XXXXX +pwProjectId=A123456789012 +' > "$PRIVATE_PUSHWOOSH_PROPERTIES" exit fi fi |