Has anyone integrated the UBER sdk into a B4a project?
If so, can you help get me started in doing so with mine?
Are there any libs that can be used?
All I want to be able to do is provide a "button" click access to UBER ride scheduling...
Thanks,
Rusty
That's exactly what I wish to do.
I think I've overly complicated this...
I need to webview.loadurl with the url info...
This works, but it gives a network error.
I'll have to figure that one out...
Thanks Don
Dim in As Intent
' Dim pm As PackageManager
Try
' Log(pm.GetVersionCode("com.ubercab"))
in.Initialize(in.ACTION_VIEW, "uber://?action=setPickup&pickup=my_location&client_id=<CLIENT_ID>")
StartActivity(in)
Catch
Log("intent error" & LastException)
End Try
which of course ends up with:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=uber://?action=setPickup&pickup=my_location&client_id=<ClientID> flg=0x20000 (has extras) }
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim pm As PackageManager
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")
Dim applist As List
applist = pm.GetInstalledPackages
For i = 0 To applist.Size-1
Log(applist.Get(i))
Next
Dim uberfound As Boolean = False
Dim in As Intent
Try
Log(pm.GetVersionCode("com.ubercab"))
uberfound = True
'in.Initialize(in.ACTION_VIEW, "uber://?action=setPickup&pickup=my_location&client_id=<CLIENT_ID>")
'StartActivity(in)
Catch
Log("uberapp not installed")
End Try
If uberfound = False Then
Log("Call your webview")
End If
End Sub
Dim uberfound As Boolean = False
Dim applist As List
applist = pm.GetInstalledPackages
For i = 0 To applist.Size-1
Log(applist.Get(i))
If applist.Get(i) = "com.ubercab" Then
uberfound = True
End If
Next
If uberfound = False Then
Log("Call your webview")
End If
If GetVersion("com.ubercab") > 0 Then
Log("Uber is installed")
Else
Log("Uber not installed")
End If
Sub GetVersion(app As String) As Int
Dim Version As Int = 0
Dim applist As List
applist = pm.GetInstalledPackages
For i = 0 To applist.Size-1
'Log(applist.Get(i))
If applist.Get(i) = app Then
Version = pm.GetVersionCode(app)
End If
Next
Return Version
End Sub
Dim in As Intent
Dim pm As PackageManagerq
Try
Log(pm.GetVersionCode("com.ubercab"))
in.Initialize(in.ACTION_VIEW, "uber://?action=setPickup&pickup=my_location&client_id=<CLIENT_ID>")
StartActivity(in)
Catch
in.Initialize(in.ACTION_VIEW, "https://m.uber.com/sign-up?client_id=<CLIENT_ID>")
StartActivity(in)
End Try