Openinstall Android Issues #
1. How to Exclude OpenInstall SDK from Code Obfuscation? #
Add the following configuration to your proguard file:
#Ignore Warnings
-dontwarn com.fm.openinstall.**
-dontwarn io.openinstall.**
#Avoid Obfuscation
-keep public class com.fm.openinstall.** {*; }
-keep public interface com.fm.openinstall.** {*; }
2.When the app has multiple processes, calling OpenInstall.init multiple times results in failure to retrieve installation parameters. #
When the App has multiple processes and OpenInstall is initialized in the onCreate method of the Application class, calling the onCreate method multiple times will trigger the initialization of OpenInstall multiple times, leading to failure in retrieving installation parameters.
Use the following code to determine whether the current process is the main process of the application. Only call the OpenInstall.init method in the main process
public boolean isMainProcess(){
int pid = android.os.Process.myPid();
ActivityManager activityManager = (ActivityManager)
getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
if (appProcess.pid == pid) {
return getApplicationInfo().packageName.equals(appProcess.processName);
}
}
return false;
}
3.Channel statistics are not updated after the channel package exported from OpenInstall is obfuscated. #
Please obfuscate the channel package through third-party tools before uploading it to the OpenInstall platform, and then export the channel package for statistics.
4. When trying to wake up an already installed app from a webpage, an initial prompt to open the app appears, followed by a download task window that blocks the initial prompt. #
This issue arises when users open an H5 webpage and click a button that triggers the API (m.wakeupOrInstall();). The OpenInstall JavaScript initially tries to wake up the app and then carries out a delayed download redirection. If the JavaScript’s delay period ends while the webpage is asking the user whether to open the app, both the prompt to open the app and the download task window will appear simultaneously due to the executed download redirection.
5.When loading a landing page in Android webview, the interface displays a net::ERR_UNKNOWN_URL_SCHEME error. #
In Android WebView, the scheme protocol is not supported and cannot be recognized properly. You need to override in the WebViewClient class: the shouldOverriderUrlLoading
method in the WebViewClient class to intercept the scheme protocol. For detailed instructions, please refer to this content (replace scheme and Appkey with the corresponding scheme and Appkey allocated by OpenInstall):
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url==null){
return false;
}
try {
if (url.startsWith("scheme://")|| url.startsWith("https://app-Appkey.opwakeup.com")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}
}
});
6.Handling clipboard read failures on Android 10 and above systems. #
When the Android SDK parameter restoration feature is used in the case of non-managed downloads, it mainly relies on the system clipboard mechanism to successfully restore installation parameters by reading system clipboard data. Therefore, in situations where the Android SDK fails to read the system clipboard, it will greatly affect the success rate of parameter restoration.
It is recommended that developers avoid behaviors that may cause clipboard read failures, such as not requesting permissions or performing other operations that may put the application in a background invisible state during initialization and when accessing parameter interfaces (getInstall); refrain from calling (init) and (getInstall) simultaneously in the Activity’s onCreate method.