Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7048525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:54:08+00:00 2026-05-28T02:54:08+00:00

My problem is quite hard to explain clearly… I call a phonegap plugin to

  • 0

My problem is quite hard to explain clearly…

I call a phonegap plugin to download and unzip a zip, and on the callback i return the url of the new page to load the new page :

bindings.js (Where the binding is done) :

showGameDetailComplete: function(data) {
    [...]
    $('#play-game').bind('tap',function() {
        var gameDownloader = new GameDownloader();
        gameDownloader.downloadGame(data.url, data.id, 
            function(data) {
                alert(data);
                document.location.href = data;
            }, function(data) {
                alert('Download failed');
            }
        );
    })
},

gamedownloader.js (The link between JS – Android) :

GameDownloader.prototype.downloadGame = function(fileUrl, gameId,
     successCallback, failureCallback) {
PhoneGap.exec(successCallback, failureCallback, "GameDownloader", "download", [ fileUrl, gameId]);
};

GameDownloaderPlugin.java (The Phonegap Android native plugin) :

public class GameDownloaderPlugin extends Plugin
{
[...]

@Override
public PluginResult execute(String action, JSONArray data, String callbackId)
{
    result = null;
    mCallbackId = callbackId;
    if (action.equals(ACTION_DOWNLOAD))
    {
        try
        {
            downloadGame(data.getString(0), data.getString(1));
            result = new PluginResult(PluginResult.Status.NO_RESULT);
            result.setKeepCallback(true);
            return result;
        }
        catch (JSONException e)
        {
            result = new PluginResult(PluginResult.Status.ERROR, "Param errors");
        }
    }
    else
    {
        result = new PluginResult(Status.INVALID_ACTION);
        Log.d("DirectoryListPlugin", "Invalid action : " + action + " passed");
    }
    return result;
}

private void downloadGame(String fileUrl, String gameId)
{
    try
    {
        /* Downloading the zip */
        [...]

        /* Unzip the zip */
        Intent iUnzip = new Intent(ctx, GameUnzipActivity.class);
        iUnzip.putExtra(UNZIP_GAMEID, gameId);
        iUnzip.putExtra(UNZIP_SRCFILE, fileName);
        ctx.startActivityForResult(this, iUnzip, GAME_UNZIP);
    }
    catch (IOException e)
    {
        if (LOG)
            Log.d("GameDownloaderPlugin", "Error: " + e);
        this.error(new PluginResult(PluginResult.Status.ERROR, "Error: " + e), mCallbackId);
    }

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode)
    {
        case (GAME_UNZIP):
        {
            if (resultCode == Activity.RESULT_OK)
            {
                if (LOG)
                    Log.d("GameDownloaderPlugin", "Game unzipped! \\o/");
                this.success(new PluginResult(PluginResult.Status.OK, "../../games/" + mGameId + "/"), this.mCallbackId);
            }
            else
            {
                if (LOG)
                    Log.d("GameDownloaderPlugin", "Bide!");
                this.error(new PluginResult(PluginResult.Status.ERROR), this.mCallbackId);
            }               
        }
            break;
    }
}
}

So here the unzip activity is called, then return a result in onActivityResult() :

PluginResult(PluginResult.Status.OK, "../../games/" + mGameId + "/"), this.mCallbackId);

Here… No problem, the game is well unzipped, the callback is well sent, received in bindings.js :

function(data) {
                alert(data);
                document.location.href = data + 'html/fr/index.html';
}

The alert(data) show the good callback, but the document.location.href line logcat an error :

Error loading url content://com.tuto.android.provider.DataFileProvider/games/1/html/fr/index.html
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.tuto.android.provider.DataFileProvider/games/1/html/fr/index.html }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
at android.app.Activity.startActivityForResult(Activity.java:2817)
at com.phonegap.DroidGap.startActivityForResult(DroidGap.java:1523)
at android.app.Activity.startActivity(Activity.java:2923)
at com.phonegap.DroidGap$GapViewClient.shouldOverrideUrlLoading(DroidGap.java:1338)
at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:216)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:323)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)

And for information, I use a provider to show my pages included in the /data/data/package/files file, that’s why I have this URL :

content://com.tuto.android.provider.DataFileProvider/games/1/html/fr/index.html

If you want more explication tell me more, it’s quite hard to understand.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:54:09+00:00Added an answer on May 28, 2026 at 2:54 am

    Well… I’ve finally found a solution :

    When I want a new page to be shown, I use a new plugin for starting the principal activity DroidGap a second time with the url parameter :

    public class MyActivity extends DroidGap
    {
      [...]
    
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
        super.onCreate(savedInstanceState);
    
        Intent i = getIntent();
        Bundle b = i.getExtras();
    
        if (b == null)
        {
            super.loadUrl(PROV_WWW + "html/fr/index.html");
        }
        else
        {
            String url = b.getString("URL");
    
            super.loadUrl(url);
        }
      }
    }
    

    It’s more a workaround than a real solution, but it’s actually working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's quite hard to explain in question title, however what I want to achieve
I'm facing a problem that gives me a quite hard time ... People having
It's quite hard to get my problem across but here goes. I have one
This is quite hard for me to explain but I try to do my
I have faced this problem quite often during the last couple of months, during
I noticed people wrote about this circular reference problem quite a bit before but
The problem is quite basic. I have a JTable showing cached data from a
My problem is quite simple: I have a 400MB file filled with 10,000,000 lines
I have quite a problem concerning the use of relational database concepts in Delphi
I have a quite common problem, as I saw in the various user groups

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.