Last active
July 22, 2016 05:55
-
-
Save ParkSangGwon/cd2e71d694222ab8c54cdaca6b88d286 to your computer and use it in GitHub Desktop.
SmartManager Issue TransActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AvoidSmartManagerActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
overridePendingTransition(0, 0); | |
finish(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AvoidSmartManagerReceiver extends BroadcastReceiver { | |
private final static String SMART_MANAGER_PACKAGE_NAME = "com.samsung.android.sm"; | |
@Override | |
public void onReceive(final Context context, Intent intent) { | |
if(Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) | |
|| Intent.ACTION_POWER_CONNECTED.equals(intent.getAction()) | |
|| Intent.ACTION_POWER_DISCONNECTED.equals(intent.getAction())) { | |
boolean isSmartManagerExist = false; | |
try { | |
context.getPackageManager().getPackageInfo(SMART_MANAGER_PACKAGE_NAME, PackageManager.GET_META_DATA); | |
isSmartManagerExist = true; | |
} catch (PackageManager.NameNotFoundException e) { | |
} | |
if(isSmartManagerExist) { | |
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
Intent serviceIntent = new Intent(context, AvoidSmartManagerActivity.class); | |
serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
context.startActivity(serviceIntent); | |
} | |
}, new Random().nextInt(3000)); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name=".smartmanager.AvoidSmartManagerActivity" | |
android:excludeFromRecents="true" | |
android:taskAffinity=":avoidSmartManager" | |
android:theme="@android:style/Theme.Translucent.NoTitleBar"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<receiver | |
android:name=".smartmanager.AvoidSmartManagerReceiver" | |
android:enabled="true"> | |
<intent-filter> | |
<action android:name="android.intent.action.BOOT_COMPLETED" /> | |
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> | |
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> | |
</intent-filter> | |
</receiver> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment