java - Removing an Android Shortcut from Home screen -
i trying remove shortcut home screen app has added. have tried methods in these links can't figure out how adapt solutions code. dont have rooted device cant find uri.
trying uninstall_shortcut shortcut won't go away
android: remove app shortcut home screen
here create shortcut:
protected void shortcutcreatoractivity(string number, string message, string name) { intent shortcutintent = new intent(getapplicationcontext(), shortcutactivity.class); shortcutintent.addflags(intent.flag_activity_new_task); shortcutintent.addflags(intent.flag_activity_clear_top); shortcutintent.putextra("number", number); shortcutintent.putextra("message", message); intent addintent = new intent(); addintent.putextra(intent.extra_shortcut_intent, shortcutintent); addintent.putextra(intent.extra_shortcut_name, name); addintent.putextra(intent.extra_shortcut_icon_resource, intent.shortcuticonresource.fromcontext(getapplicationcontext(), r.drawable.ic_launcher)); addintent.setaction("com.android.launcher.action.install_shortcut"); getapplicationcontext().sendbroadcast(addintent); }
this manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abezukor.autosms" > <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="com.android.launcher.permission.install_shortcut" /> <uses-permission android:name="com.android.launcher.permission.uninstall_shortcut" /> <uses-permission android:name="android.permission.send_sms" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".relativelayoutactivity" android:label="@string/app_name" > </activity> <activity android:name=".listviewactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".shortcutactivity" android:label="autosms"> <intent-filter> <action android:name="android.intent.action.create_shortcut" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> </application> </manifest>
thanks in advance.
Comments
Post a Comment