I Inman Well-Known Member Licensed User Longtime User Sep 9, 2011 #1 My app has 2 activities. One is the normal main activity that is opened from the launcher by clicking it's icon. The second is the share activity which basically adds my app to the Android "Share" menu. And this works fine as well as I get the data passed from the Share menu, correctly in my share activity. Now the issue is with the intent chooser. Check the following code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "") i.SetType("text/*") i.PutExtra("android.intent.extra.TEXT", "this is the message") i.WrapAsIntentChooser("Choose") StartActivity(i) This is a simple code that should show the Android share menu. The above code works fine when given inside the Activity_Create of the main activity. But when I put it inside the Activity_Create of my share activity, nothing happens. In other words, when I call my app from the Android web browser using share menu, the above code doesn't show the chooser window. Is this some limitation of the Android system?
My app has 2 activities. One is the normal main activity that is opened from the launcher by clicking it's icon. The second is the share activity which basically adds my app to the Android "Share" menu. And this works fine as well as I get the data passed from the Share menu, correctly in my share activity. Now the issue is with the intent chooser. Check the following code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "") i.SetType("text/*") i.PutExtra("android.intent.extra.TEXT", "this is the message") i.WrapAsIntentChooser("Choose") StartActivity(i) This is a simple code that should show the Android share menu. The above code works fine when given inside the Activity_Create of the main activity. But when I put it inside the Activity_Create of my share activity, nothing happens. In other words, when I call my app from the Android web browser using share menu, the above code doesn't show the chooser window. Is this some limitation of the Android system?
Erel B4X founder Staff member Licensed User Longtime User Sep 9, 2011 #2 Did you set an intent filter to your 'share' activity? Does your share activity automatically start another activity? Upvote 0
Did you set an intent filter to your 'share' activity? Does your share activity automatically start another activity?
I Inman Well-Known Member Licensed User Longtime User Sep 9, 2011 #3 This is how I defined the share activity in the Manifest file. <activity android:windowSoftInputMode="stateHidden" android:launchMode="singleTop" android:name="share" android:label="Browser app" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar"> <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain"/> </intent-filter> </activity> And the share part actually works. I can get the url shared by browser, using activity.GetStartingIntent and intent.GetExtra, inside the Activity_Create. It is just that I cannot get the chooser window for any kind of intent. And no, it doesn't start any other activity. It has an activity.finish given at the end of Activity_Create, but even when I commented that line, the chooser window doesn't show up. Upvote 0
This is how I defined the share activity in the Manifest file. <activity android:windowSoftInputMode="stateHidden" android:launchMode="singleTop" android:name="share" android:label="Browser app" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar"> <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain"/> </intent-filter> </activity> And the share part actually works. I can get the url shared by browser, using activity.GetStartingIntent and intent.GetExtra, inside the Activity_Create. It is just that I cannot get the chooser window for any kind of intent. And no, it doesn't start any other activity. It has an activity.finish given at the end of Activity_Create, but even when I commented that line, the chooser window doesn't show up.
Erel B4X founder Staff member Licensed User Longtime User Sep 11, 2011 #4 It may be a limitation of Android. There are also cases when Android ignores the "start activity" message. You can try using a timer to send the message and see if it helps. Upvote 0
It may be a limitation of Android. There are also cases when Android ignores the "start activity" message. You can try using a timer to send the message and see if it helps.
I Inman Well-Known Member Licensed User Longtime User Sep 11, 2011 #5 Cool. Timer did the trick. But the following need to be done to get this working: Timer interval should be at least 100 activity.finish, which is needed to close this activity automatically, should be moved from Activity_Create to Timer_Tick Timer_Tick should have a DoEvents before the call StartActivity(intent1) (in my case at the beginning itself) Upvote 0
Cool. Timer did the trick. But the following need to be done to get this working: Timer interval should be at least 100 activity.finish, which is needed to close this activity automatically, should be moved from Activity_Create to Timer_Tick Timer_Tick should have a DoEvents before the call StartActivity(intent1) (in my case at the beginning itself)