Converting Java to PHP

Discussion in 'Programming' started by rodneystover, Jan 17, 2011.

  1. #1
    I am needing to convert the following code into PHP. I am on a shared hosting site and do not have the capability to run java code.

    Explanation of what I'm doing. I am using the ScanLife free barcode app for android as a basic scanner app. I can invoke the scanner from a php page using the code:
    <a href="scanlife://sdk/scan">Launch ScanLife</a>
    But instead of using the app to continue on and do the comparison pricing and coupon links, I am wanting to capture the results of the scan on the upc and do a lookup in mysql and return my database info.

    ScanLife has the following code in their SDK documentation that uses their app for the scanner part and returns the results as a variable. So I just need helping in getting this code converted into PHP.
    Thanks so much for any help/advice.


    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){
    {
     
    rodneystover, Jan 17, 2011 IP
  2. Cozmic

    Cozmic Member

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #2
    Are you sure that code is meant to be used on a server? The code snippet you provided is pretty small, but it looks like you are adding buttons with listeners instead of HTML.
     
    Cozmic, Jan 17, 2011 IP
  3. rodneystover

    rodneystover Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Basically I am wanting to make a mobile site in php, that will launch the scanner module in the app, which I am able to via 'scanlife://sdk/scan' if the app is installed then capture the result (which is converting the scan into a text variable of the upc code it scanned) and then take the upc result and lookup the upc in a mysql table that will display results to a mobile web page. I have several upcs of apparel and I want to show the customer what custom printing is available for those items. I am basically trying to get around having to develop an app for all the different specific phones. The ScanLife app works on all android, blackberry and iphone models, so i thought that would be an easier route.
     
    rodneystover, Jan 17, 2011 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150