首先,在manifest中修改Application的theme属性。改为
android:theme="@android:style/Theme.NoDisplay"
然后,随意新建一个Activity(例如AuthActivity)。
public class AuthActivity extends AppCompatActivity {
private static final String TAG = "AuthActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth);
}
}
然后在启动Activity的intent-filter中加入data android:host(即添加隐式启动的data)。
<data android:host="AuthActivity" android:scheme="com.demo.myapplication"/>
如下图所示:
public class MainActivity extends Activity {
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d(TAG,"11111");
}
}
然后运行程序(以MainActivity作为启动activity)。可通过打印log判断apk是否运行。
参考记录:
Android - 安装应用(APP) 不显示图标
https://blog.csdn.net/caroline_wendy/article/details/42783603