Sub Process_Globals
Private NativeMe As JavaObject 'use Java to access
End Sub
Sub Service_Create
NativeMe.InitializeContext
NativeMe.RunMethod("checkuber", Null) 'run the Java method
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub ******************* THIS IS LINE 26 **********************
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub
#if java
import java.net.NetworkInterface;
import java.util.Collections;
import java.util.List;
public static String checkuber() {
try {
PackageManager pm = context.getPackageManager();
pm.getPackageInfo("com.ubercab", PackageManager.GET_ACTIVITIES);
String uri =
"uber://?action=setPickup&pickup=my_location&client_id=<CLIENT_ID>";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(uri));
startActivity(intent);
} catch (PackageManager.NameNotFoundException e) {
// No Uber app! Open mobile website.
String url = "https://m.uber.com/sign-up?client_id=<CLIENT_ID>";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
}
#end if