Add my app to the list of “Complete Action Using” for attachments in gmail

后端 未结 1 2047
一生所求
一生所求 2021-02-10 15:58

I would like my app to appear in the list within gmail. This list comes up when I click the Preview button within the Gmail app.

I would like to know what entries need t

1条回答
  •  死守一世寂寞
    2021-02-10 16:43

    Have a look at Intent Filters: http://developer.android.com/guide/components/intents-filters.html

    Specifically, I think you'll find the Note Pad Example helpful: http://developer.android.com/guide/components/intents-filters.html#npex

    Personally, I had this same exact issue a few hours ago. I needed to open text files with my app. To do so, I had to add this to my manifest:

    
        
            
            
        
        
            
            
            
            
            
            
        
    
    

    With just this, I was able to make my app appear in the list of available applications to open text files from Astro, and allow it to be launched.

    To make it actually handle opening the files, you need to add something like this to your onCreate in the activity:

    Intent intent = getIntent();
    Action action = intent.getAction();
    if (action.equals("com.google.android.apps.drive.DRIVE_OPEN")) {
        // Handle the intent from google drive...
    } else if (action.equals("android.intent.action.VIEW")) {
        // Handle the intent to view the file...
    } else // And so on...
    

    0 讨论(0)
提交回复
热议问题