android - Removed App Icon After That New package not yet registered with the system Message Encountered -
in application have removed application icon programatically like
packagemanager p = getpackagemanager(); p.setcomponentenabledsetting(getcomponentname(), packagemanager.component_enabled_state_disabled, packagemanager.dont_kill_app);
after application installs , works fine when try re-install application after changes gives following
new package not yet registered system
any thing im doing worng ...
regards.
the error accures because disabled activity completly in android package manager. in first run it´s fine because think have defined activity-alias in manifest new shortcut. when update app, app tries start disabled launcher , boom can´t start cause disabled. (not perfect) workaround following:
<activity android:name="com.example.your_launchscreen" android:icon="@drawable/your_alternative_icon" android:label="notrealappname" android:windowsoftinputmode="statealwayshidden" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity-alias android:name=".launchscreen_2" android:enabled="true" android:icon="@drawable/ic_launcher" android:label="@string/real_app_name" android:targetactivity=".your_launchscreen" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity-alias>
now in activity:
getpackagemanager(). setcomponentenabledsetting(newcomponentname( activity,your_launchscreen.class.getname()+"_2"), packagemanager.component_enabled_state_disabled, packagemanager.dont_kill_app); toast.maketext(activity, "real appicon hidden...", toast.length_long).show();
and showing again:
packagemanager p = getpackagemanager(); componentname componentname = new componentname(activity,your_launchscreen.class.getname()+"_2"); p.setcomponentenabledsetting(componentname, packagemanager.component_enabled_state_enabled, packagemanager.dont_kill_app); toast.maketext(activity, "real appicon visible again...", toast.length_long).show();
this solution not perfect, because after app installation have 2 app icons. real icon , hidden one. can hide real icon , update app without problems.
Comments
Post a Comment