I am doing an Android application. I want to hide the application icon in the emulator and I want to start my application by pressing some numbers, for instance 456#. Is there a way to do this?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
If you want to hide the app icon it's a good idea to show the icon first and let the user know how to start the app once the icon is gone. First create an activity-alias in the manifest and move your intent filter there. This way you can disable the icon without disabling the activity.
Get the component name of the launcher alias using your package name:
You can check if it's already disabled...
...and disable it when appropriate after giving the user information:
To launch from the dialer create a broadcast receiver:
Add it to the manifest:
And add the permission to the manifest:
To Hide app icon from launcher programatically you can do this
To launch app by pressing number first add folowing permission in mainfest file
Then register receiver
Then create a receiver class
Note that the solution:
will make the app NOT upgradeable from google play as the OS will not find the package after this component disabling and will not able to re-install it, unless the app is not manullay uninstalled (which is not a user friendly behaviour)
The answer to the first part of your question, try this code:
Your application will not be visible, but the user can still find it in the Settings >> Applications >> Manage Application
This answer may also be helpful for you.
Please do not forget to post your answer here, if you have already achieved the functionality(pressing some number & opening our application).