Wire Umeng public app key and preinit
This commit is contained in:
+5
-1
@@ -51,7 +51,11 @@ android {
|
|||||||
dimension "distribution"
|
dimension "distribution"
|
||||||
applicationId "ai.multicasual.app"
|
applicationId "ai.multicasual.app"
|
||||||
resValue "string", "app_name", "Multi-Casual"
|
resValue "string", "app_name", "Multi-Casual"
|
||||||
manifestPlaceholders = [usesCleartextTraffic: "false", deepLinkScheme: "multi-casual"]
|
manifestPlaceholders = [
|
||||||
|
usesCleartextTraffic: "false",
|
||||||
|
deepLinkScheme: "multi-casual",
|
||||||
|
umengDeepLinkScheme: "um.${umengPublicAppKey}"
|
||||||
|
]
|
||||||
buildConfigField "String", "MULTICA_ENVIRONMENT", "\"public\""
|
buildConfigField "String", "MULTICA_ENVIRONMENT", "\"public\""
|
||||||
buildConfigField "String", "MULTICA_API_BASE_URL", "\"https://api.multica.ai\""
|
buildConfigField "String", "MULTICA_API_BASE_URL", "\"https://api.multica.ai\""
|
||||||
buildConfigField "String", "MULTICA_WEB_BASE_URL", "\"https://app.multica.ai\""
|
buildConfigField "String", "MULTICA_WEB_BASE_URL", "\"https://app.multica.ai\""
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="${deepLinkScheme}" />
|
<data android:scheme="${deepLinkScheme}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="${umengDeepLinkScheme}" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public final class AppAnalytics {
|
|||||||
|
|
||||||
public static void initializeIfAllowed(Context context) {
|
public static void initializeIfAllowed(Context context) {
|
||||||
Context appContext = context.getApplicationContext();
|
Context appContext = context.getApplicationContext();
|
||||||
|
preInitializeIfNeeded(appContext);
|
||||||
if (!new AnalyticsConsentStore(appContext).isGranted()) {
|
if (!new AnalyticsConsentStore(appContext).isGranted()) {
|
||||||
Log.i(TAG, "Analytics disabled until user grants consent.");
|
Log.i(TAG, "Analytics disabled until user grants consent.");
|
||||||
return;
|
return;
|
||||||
@@ -57,6 +58,20 @@ public final class AppAnalytics {
|
|||||||
trackAppOpenOnce(appContext);
|
trackAppOpenOnce(appContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void preInitializeIfNeeded(Context context) {
|
||||||
|
if (!BuildConfig.UMENG_ENABLED || TextUtils.isEmpty(safe(BuildConfig.UMENG_APP_KEY))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Class.forName("com.umeng.commonsdk.UMConfigure")
|
||||||
|
.getMethod("preInit", Context.class, String.class, String.class)
|
||||||
|
.invoke(null, context.getApplicationContext(), BuildConfig.UMENG_APP_KEY, BuildConfig.UMENG_CHANNEL);
|
||||||
|
Log.i(TAG, "Umeng preInit completed.");
|
||||||
|
} catch (Throwable error) {
|
||||||
|
Log.w(TAG, "Umeng preInit failed; app launch continues.", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String selectedRouteForTesting(Context context) {
|
static String selectedRouteForTesting(Context context) {
|
||||||
return selectRoute(context);
|
return selectRoute(context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user