Ahmet Onay
Ahmet Onay

Reputation: 3

Intent delivers null on Android 13

Since Android 13 you need to use Intent Filter and Categories to pass data with Intent.

I am using the method "Intent.PutIntegerArrayListExtra("")" so i specified the filter like that.

[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] {
    Intent.CategoryDefault })
]

But this doesn't work. So I thought that I maybe need to specify the data but I dont know which "DataMimeTyp" I need for an ArrayList.

Update:

Problem:

First Activity:

var intent = new Intent(this, typeof(ExampleActivity));
intent.PutIntegerArrayListExtra("Items", items.Select(x => (Java.Lang.Integer)x).ToList());

Second Activity:

var items= Intent.GetStringArrayListExtra("Items");

Returns null on Android 13.

Workaround/Solution:

FirstActivity:

Bundle bundle = new Bundle();
var intent = new Intent(this, typeof(ExampleActivity));
List<Java.Lang.Integer> itemsArrayList = items.Select(x => (Java.Lang.Integer)x).ToList();
bundle.PutIntegerArrayList("Items", itemsArrayList);
intent.PutExtras(bundle);

SecondActivity:

Bundle bundle = Intent.Extras;
var items = bundle.GetIntegerArrayList("Items");

Upvotes: 0

Views: 769

Answers (1)

Guangyu Bai - MSFT
Guangyu Bai - MSFT

Reputation: 4586

There are too many types so that I could not upload all of them. For more details, please check the link. https://github.com/khellang/MimeTypes/blob/master/src/MimeTypes/MimeTypes.cs.pp

static MimeTypes()
    {
        s_fallbackMimeType = DefaultFallbackMimeType;

        s_typeMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
        {
           
            { "ear", "application/java-archive" },
            { "ecma", "application/ecmascript" },
            { "edm", "application/vnd.novadigm.edm" },
            { "edx", "application/vnd.novadigm.edx" },
            { "efif", "application/vnd.picsel" },
            { "ei6", "application/vnd.pg.osasli" },
            { "elc", "application/octet-stream" },
            { "emf", "application/x-msmetafile" },
            { "eml", "message/rfc822" },
            { "emma", "application/emma+xml" },
            { "emz", "application/x-msmetafile" },
            { "eol", "audio/vnd.digital-winds" },
            { "eot", "application/vnd.ms-fontobject" },
            { "eps", "application/postscript" },
            { "epub", "application/epub+zip" },
            { "es", "application/ecmascript" },
            { "es3", "application/vnd.eszigno3+xml" },
            { "esa", "application/vnd.osgi.subsystem" },
            { "esf", "application/vnd.epson.esf" },
            { "et3", "application/vnd.eszigno3+xml" },
            { "etx", "text/x-setext" },
            { "eva", "application/x-eva" },
            { "evy", "application/x-envoy" },
            { "exe", "application/octet-stream" },
            { "exi", "application/exi" },
            { "exr", "image/aces" },
            { "ext", "application/vnd.novadigm.ext" },
            { "ez", "application/andrew-inset" },
            { "ez2", "application/vnd.ezpix-album" },
            { "ez3", "application/vnd.ezpix-package" },                              
            { "t", "text/troff" },
            { "t3", "application/x-t3vm-image" },
            { "t38", "image/t38" },
            { "taglet", "application/vnd.mynfc" },
            { "tao", "application/vnd.tao.intent-module-archive" },
            { "tap", "image/vnd.tencent.tap" },
            { "tar", "application/x-tar" },
            { "tcap", "application/vnd.3gpp2.tcap" },
            { "tcl", "application/x-tcl" },
            { "td", "application/urc-targetdesc+xml" },
            { "teacher", "application/vnd.smart.teacher" },
            { "tei", "application/tei+xml" },
            { "tex", "application/x-tex" },
            { "texi", "application/x-texinfo" },
            { "texinfo", "application/x-texinfo" },
            { "text", "text/plain" },
            { "tfi", "application/thraud+xml" },
            { "tfm", "application/x-tex-tfm" },
            { "tfx", "image/tiff-fx" },
            { "tga", "image/x-tga" },
            { "thmx", "application/vnd.ms-officetheme" },
            { "tif", "image/tiff" },
            { "tiff", "image/tiff" },
            { "tk", "application/x-tcl" },
            { "tmo", "application/vnd.tmobile-livetv" },
            { "toml", "application/toml" },
            { "torrent", "application/x-bittorrent" },
            { "tpl", "application/vnd.groove-tool-template" },
            { "tpt", "application/vnd.trid.tpt" },
            { "tr", "text/troff" },
            { "tra", "application/vnd.trueapp" },
            { "trm", "application/x-msterminal" },
            { "ts", "video/mp2t" },
            { "tsd", "application/timestamped-data" },
            { "tsv", "text/tab-separated-values" },
            { "ttc", "font/collection" },
            { "ttf", "font/ttf" },
            { "ttl", "text/turtle" },
            { "ttml", "application/ttml+xml" },
            { "twd", "application/vnd.simtech-mindmapper" },
            { "twds", "application/vnd.simtech-mindmapper" },
            { "txd", "application/vnd.genomatix.tuxedo" },
            { "txf", "application/vnd.mobius.txf" },
            { "txt", "text/plain" },
            
            
        };
    }

Upvotes: 0

Related Questions