Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example app not working on android #7

Open
hawkbee1 opened this issue Dec 12, 2023 · 1 comment
Open

example app not working on android #7

hawkbee1 opened this issue Dec 12, 2023 · 1 comment

Comments

@hawkbee1
Copy link

Example app is not working on android and I don't see any activity-alias inside AndroidManifest.xml @chuanpham

@chuanpham
Copy link
Owner

chuanpham commented Dec 13, 2023

Hi, sorry but this plugin is no longer maintained at the moment, please check #2 (comment) to see if it helps, thanks!

And by the way, this is an example:

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
<application 
    android:requestLegacyExternalStorage="true"
    android:label="appname"
    android:icon="@mipmap/ic_launcher"
    android:largeHeap="true"
    android:usesCleartextTraffic="true">

    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize"
        android:enabled="true">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <!-- Displays an Android View that continues showing the launch screen
             Drawable until Flutter paints its first frame, then this splash
             screen fades out. A splash screen is useful to avoid any visual
             gap between the end of Android's launch screen and the painting of
             Flutter's first frame. -->
       
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

        <!-- Deep Links -->

    </activity>

    <activity-alias
     android:label="appname"
     android:icon="@mipmap/ic_launcher"
     android:name=".default"
     android:enabled="false"
     android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />       

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->

    </activity-alias>

    <activity-alias
        android:label="appname"
        android:icon="@mipmap/ic_nozomi"
        android:name=".nozomi"
        android:enabled="false"
        android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->
    </activity-alias>

    <activity-alias
        android:label="appname"
        android:icon="@mipmap/ic_moonlight"
        android:name=".moonlight"
        android:enabled="false"
        android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->

    </activity-alias>

    <activity-alias
        android:label="appname"
        android:icon="@mipmap/ic_ipsc"
        android:name=".ipsc"
        android:enabled="false"
        android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->
    </activity-alias>

    <activity-alias
        android:label="appname"
        android:icon="@mipmap/ic_vanphuc"
        android:name=".vanphuc"
        android:enabled="false"
        android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->
        
    </activity-alias>

     <activity-alias
        android:label="appname"
        android:icon="@mipmap/ic_hadopm"
        android:name=".hadopm"
        android:enabled="false"
        android:targetActivity=".MainActivity">

        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Put all deep links inside activity alias-->
    </activity-alias>

    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />

</application>

<!-- If your application allows payment with APP_TO_APP method -->
<!-- And your targetApi is greater than or equal 30 -->

How I use it:

const List listAvailableIcon = ["nozomi", "moonlight", "ipsc", "vanphuc", "hadopm", "default", "MainActivity"];

if (Platform.isAndroid) {
  Future.delayed(Duration(seconds: 2), () async {
    await DynamicIconFlutter.setIcon(
        icon: listAvailableIcon[index],
        listAvailableIcon: listAvailableIcon);
  });
} else {
  try {
    if (await DynamicIconFlutter.supportsAlternateIcons) {
      await DynamicIconFlutter.setAlternateIconName(
          listAvailableIcon[index]);
      print("App icon change successful");
      return;
    }
  } on PlatformException {
    if (await DynamicIconFlutter.supportsAlternateIcons) {
      await DynamicIconFlutter.setAlternateIconName(null);
      print("Change back to default app icon");
      return;
    } else {
      print("Failed to change app icon");
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants