0

I have uploaded android app in four languages (en,ar,fr,ru) and the app name will be different from language to other, till now everything is OK but If the user device language is English and he tries to search for Arabic app name, the app not shown on the search. Is there any solution for this problem?

1 Answers1

1

if you have limited option so use and change it in code. detect Input Language and change alias Detect Input Language:

private void printInputLanguages() {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   List<InputMethodInfo> ims = imm.getEnabledInputMethodList();

   for (InputMethodInfo method : ims) {
       List<InputMethodSubtype> submethods = imm.getEnabledInputMethodSubtypeList(method, true);
       for (InputMethodSubtype submethod : submethods) {
          if (submethod.getMode().equals("keyboard")) {
             String currentLocale = submethod.getLocale();
             Log.i(TAG, "Available input method locale: " + currentLocale);
          }
       }
   }
}

then remove Action_Main and Launcher category from Main Activity in Manifest and replace it with these

<activity-alias android:label="@string/app_name_in_other_language" 
    android:icon="@drawable/icon" 
    android:name=".MainActivity_Lang_Other"
    android:enabled="false"
    android:targetActivity=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>   
</activity-alias>

and like to for other languages then in onCreate() of main activity

getPackageManager().setComponentEnabledSetting(
        new ComponentName("package", "package.MainActivity_Lang_Other"), 
            PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);

and keep in mind system needs one of aliases to be enable so set it to main language, for example English.

Community
  • 1
  • 1
Elias Fazel
  • 2,093
  • 16
  • 20