I am fairly new to PHP and not sure how to convert this code to PHP. Any help would greatly be appreciated. try{ // Launch ScanLife Intent intent = new Intent(); intent.setClassName("com.ScanLife", "com.ScanLife.ScanLife"); Uri uri = Uri.parse("scanlife://sdk/scan"); intent.setData(uri); startActivity(intent); }catch(ActivityNotFoundException ex){ // Launch the Download of ScanLife new AlertDialog.Builder(this) .setTitle("Install ScanLife?") .setMessage("The application requires ScanLife Barcode Scanner. Would you like to install it?") .setPositiveButton("Yes", new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dg, int v){ Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=com.ScanLife")); startActivity(intent); } }) .setNegativeButton("No", new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dg, int v){ } }) .show(); }catch(Exception ex){ } Just in case anyone is wondering what this code is for I am writing a web accessible page for a grocery store that can scan a UPC with their android or iphone and it pull info from a mysql database. The above code launches the Scanlife free scanning app and I need it in PHP for the web page to launch the app instead of writing a phone specific app. Thanks again.
You know that php doesn't have to ability to set ask for user input while it is running? I.e. All the user input must be set before running the script.
Basically I am looking for the part of the code toward the end where I can capture the results of the intent.setData(uri); startActivity(intent); and what ends up in the .show();
This is about the only thing translateable to php: try { $intent = new Intent; $intent->setClassName("com.ScanLife", "com.ScanLife.ScanLife"); $uri="scanlife://sdk/scan"; $intent->setData($uri); } catch(ActivityNotFoundException $e) { //Unable to translate } PHP: Although I must admit I don't really know Python that well.
Let me play around with that code today. You're help should push me in the right direction. Thank you.