Android Question UBER sdk

Rusty

Well-Known Member
Licensed User
Longtime User
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
 
Upvote 0
Thanks Erel,
Where did you do it for the first intent? I'm not seeing a reference.
Rusty
 
Upvote 0
Please don't get frustrated with me...
I have
Code:
        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) }
I can't seem to add the extras or whatever to point it to my activity/webview...
Rusty
 
Upvote 0
Code:
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
 

Attachments

Upvote 0
you also can use
Code:
    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
 
Upvote 0
another way
Code:
    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
 
Upvote 0
This is a port of the Java code you posted:
Code:
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
 
Upvote 0
Back
Top