@@ -78,5 +78,49 @@ There is `JavaObject` class with some internal methods for JNI access. For examp
78
78
}
79
79
```
80
80
81
+ ## Real world example
82
+ Assume you want to start sharing `Intent ` and filter app to show . Easy :
83
+ ```csharp
84
+ public static void Share (string body , string subject , string mimeType = " text/plain" , string chooserTitle = " Choose application" ) {
85
+ Intent intent = new Intent (Intent .ACTION_SEND );
86
+ intent .SetType (mimeType )
87
+ .PutExtra (Intent .EXTRA_SUBJECT , subject )
88
+ .PutExtra (Intent .EXTRA_TEXT , body );
89
+
90
+ var intentList = new List <Intent >();
91
+
92
+ var activity = Internal .GetCurrentActivity ();
93
+ var pm = activity .GetPackageManager ();
94
+ var resInfo = pm .QueryIntentActivities (intent , 0 );
95
+
96
+
97
+ for (int i = 0 ; i < resInfo .Count ; i ++ ) {
98
+ ResolveInfo ri = resInfo [i ];
99
+ string packageName = ri .ActivityInfo .GetPackageName ();
100
+ if (packageName .Contains (" vkontakte" ) || packageName .Contains (" instagram" ) || packageName .Contains (" skype" )) {
101
+ Intent newIntent = new Intent (Intent .ACTION_SEND );
102
+ newIntent .SetPackage (packageName )
103
+ .PutExtra (Intent .EXTRA_SUBJECT , subject )
104
+ .PutExtra (Intent .EXTRA_TEXT , body )
105
+ .SetType (mimeType );
106
+
107
+ intentList .Add (newIntent );
108
+ }
109
+ }
110
+
111
+ Intent intentt = intentList [0 ];
112
+ intentList .RemoveAt (0 );
113
+ Parcelable [] extraIntents = new Parcelable [intentList .Count ];
114
+
115
+ for (int i = 0 ; i < intentList .Count ; i ++ ) {
116
+ extraIntents [i ] = intentList [i ];
117
+ }
118
+
119
+ var chooser = Intent .CreateChooser (intentt , chooserTitle );
120
+ chooser .PutExtra (Intent .EXTRA_INITIAL_INTENTS , extraIntents );
121
+ activity .StartActivity (chooser );
122
+ }
123
+ ```
124
+
81
125
## P.S.
82
126
There are not much you can do with this lib right now . But I 'm going add new classes/methods from time to time.
0 commit comments