Holy crap Batman, I figured it out.
1) There is internal calculator, but some manufacturers like Samsung take it out and put in their own.
2) Using erel's code listed in instructions, will only display internal calculator from google. So using a Samsung phone, you will get an error because it can't find it.
Sub Calculator
Dim i As Intent
i.Initialize("", "")
i.SetComponent("com.android.calculator2/.Calculator")
Try
StartActivity(i)
Catch
ToastMessageShow("Calculator app not found.", True)
End Try
End Sub
3) You can use the following code from phone to look for package name of calculator. I assignisged this to a button so when I click a button a list pops up with all the packages.
'-----------------------------------------
Dim p As Phone
Dim sb As StringBuilder
sb.Initialize
p.Shell("pm", Array As String("list", "packages"), sb, Null)
Msgbox(sb.ToString, "Installed packages:")
''-------------------------------------
4) I found a line that said "Package: com.sec.android.app.calculator
5) I just replaced the line for the internal calculator with the line for the Samsung calculator like
'Pops up internal android calulator
Dim i As Intent
i.Initialize("", "")
i.SetComponent("com.sec.android.app.calculator/.Calculator")
Try
StartActivity(i)
Catch
ToastMessageShow("Calculator app not found.", True)
End Try
6) and it worked. So using this example, it will only run a calculator with the sameung name, not an internal one. So you have to first check for google calc, if none then go through a list of manufacters like samsung. I am not sure about the try and catch, but could someone give an example of modified code to check for internal calc first and if don't find, then look for Samsung. That way when we find other calcs, we can just add to the code.
7) Here's a beginning list of calculators by manufacturer or device. Maybe this could go into manual.
Standard Internal Google Calc: i.SetComponent("com.android.calculator2/.Calculator")
Samsung Galaxy S1 Epic 4 G Calc: i.SetComponent("com.sec.android.app.calculator/.Calculator")
8) So here's my nested try to look for internal calc then Samsung. It only does 2, hopefully someone wil rewrite without nested loop.
'-------------------------------------
Sub Button1100Calculator_Click
'-------------------------------------
'Pops up internal android calulator
Dim Cal As Intent
Cal.Initialize("", "")
'--------------------------
'list of calcualtor package names by device
'COMMENT: Cal.SetComponent("com.android.calculator2/.Calculator") 'internal google-need to get this to check
'COMMENT: Cal.SetComponent("com.sec.android.app.calculator/.Calculator") 'samgsung epic 4g
'---------------
Try
Cal.SetComponent("com.android.calculator2/.Calculator")
StartActivity(Cal)
Catch
'==========
Try
Cal.SetComponent("com.sec.android.app.calculator/.Calculator")
StartActivity(Cal)
Catch
Msgbox("Calculator not found for your device. When the next screen pops up, scroll down list until you find something like 'Package: com.sec.android.app.calculator'. Write it down and send it to us. We'll try to include it in the next update.","")
'-----------------------------------------
Dim p As Phone
Dim sb As StringBuilder
sb.Initialize
p.Shell("pm", Array As String("list", "packages"), sb, Null)
Msgbox(sb.ToString, "Installed packages:")
'-------------------------------------
End Try
'==============
End Try
'----------------
End Sub