Selecting a particular person to view would result in a new intent is similar to the pick action, but allows the caller to specify the kind of data they want back so that the system can find the appropriate activity to pick something of that data type. putExtra - we use this putExtra () method to add extra information to our Intent. Extras can be passed along with these intents with additional data and options. This example is a typical top-level entry into the Contacts application, showing you the list of people. The Clover platform uses the Android Intents system to allow third-party. That is demonstrated in the following code. You can find an example xml file here link Make sure to change the package name to. Note how the VIEW action does what is considered the most reasonable thing for a particular URI.ĪCTION_DIAL tel:123 - Display the phone dialer with the given number filled in.ĪCTION_EDIT content://contacts/people/1 - Edit information about the person whose identifier is "1".ĪCTION_VIEW content://contacts/people/ - Display a list of people, which the user can browse through. The component which receives the intent can use the getIntent().getExtras() method call to get the extra data. Create a new Unity project Create the android plugin directory (Assets/Plugins/Android) Create a new xml file called AndroidManifest.xml in the Android folder (this is important- anywhere else and Unity wont pick it up). The primary pieces of information in an intent are:Īction - The general action to be performed, such as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc.ĭata - The data to operate on, such as a person record in the contacts database, expressed as a Uri.ĪCTION_VIEW content://contacts/people/1 - Display information about the person whose identifier is "1".ĪCTION_DIAL content://contacts/people/1 - Display the phone dialer with the person filled in.ĪCTION_VIEW tel:123 - Display the phone dialer with the given number filled in. The result code can be one of the predefined Android codes (RESULTCANCELED, RESULTOK), or an integer value of. getIntent ().getExtras () String firstName1 extras.getString ( 'firstName' ) String lastName2 extras. For information about how to create and resolve intents, read the Intents and Intent Filters developer guide. getIntent () String firstName intent.getStringExtra ( 'firstName' ) String lastName intent.getStringExtra ( 'lastName' ) // Hoc Bundle extras this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |