#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Pm As PackageManager 'Phone library
Dim Inte As Intent
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
For Each st As String In Pm.GetInstalledPackages
Log(st)
If st.Contains("camera") =True Then
Inte=Pm.GetApplicationIntent(st)
If Inte.IsInitialized Then StartActivity(Inte)
Exit
End If
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sorry, I accidentally selected QUOTEPlease use [CODE]code here...[/CODE] tags when posting code.
For Each st As String In Pm.GetInstalledPackages
Log(st)
If st.Contains("camera") =True Then
Inte=Pm.GetApplicationIntent(st)
If Inte.IsInitialized Then StartActivity(Inte)
Exit
End If
Next
For Each st As String In Pm.GetInstalledPackages
If st.Contains("camera") =True Then
Log(st)
End If
Next
End Sub
Start with debugging. LOG ALL apps returning.
There may be more that just ONE which contains the string camera.
What does the log output?B4X:For Each st As String In Pm.GetInstalledPackages If st.Contains("camera") =True Then Log(st) End If Next End Sub
It's not listed twice, I'm just logging it again if it appears.. Check the code, there is also one in side the If containsIf the app is not starting then i guess there is no valid ApplicationIntent returned.
Based on you last post the app is listed twice.
Check both of them if they provide a valid ApplicationIntent
For Each st As String In Pm.GetInstalledPackages
Log(st)
If st.Contains("camera") =True Then
Inte=Pm.GetApplicationIntent(st)
Inte.Initialize("??","??")
If Inte.IsInitialized Then StartActivity(Inte)
Exit
End If
Next
The intent based camera example will open the default camera app. If there is no default set then it will ask the user to select an app.
If you want the user to always select the app then call Intent.WrapAsIntentChooser.
i.Initialize("android.media.action.VIDEO_CAPTURE", "")
i.Initialize("android.media.action.VIDEO_CAMERA", "")
There is no such thing. You cannot control the third party app behavior.I need to it open without selecting either as I have the camera set to always open in the last mode used. In my case it's Super Slow-Mo.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?