Can someone tell me please why this gives me null on the variable intent
?
public class MainActivity extends AppCompatActivity {
private static String action = "com.google.android.youtube";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onResume() {
super.onResume();
this.launch();
}
public void launch() {
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(action);
System.out.println("debug: " + intent);
//startActivity(intent);
}
}
i test this on a pixel 4 and i never do uninstall youtube. also, sidequest list the app and gives me the package com.google.android.youtube
null
. Thanks for the link. Would you post it as an answer? – Transubstantiate