Redirection to a Different Application without Connectivity Check (RDAC)

ECn Categories > Redirection to a Different Application without Connectivity Check (RDAC)

The app redirects the user to another app (different than a browser) and it does not works because it has not internet connection.

Amount of Issues App List
67 (A9) DuckDuckGo, (A10) OsmAnd, (A26) Opengur, (A29) Ouroboros, (A31) Open Weather, (A36) Stepik

Subcategories

Redirection to a WebPage without Connectivity Check (RWPC) »

The app redirects the user to a web page (using a browser) and it does not works because it has not internet connection.

Examples

My Expenses

Category: Finance
v 2.7.9
Scenario: To tell a friend without internet connection
This video shows a redirection to another app without connectivity check, at second 6 the user selects from the upper-right corner menu the option "Tell a friend", this open the application chooser, but due to the connection less this chooser should not be showed unless there is connection or the available applications should not need connection to perform the action.

The following code snippets show the classes and files that are involved in the generation of the previuos issue.

In order to see how this error is generated, we need to review all the flow event. First, we have the layout that is displayed when the upper-right menu is selected, the following snippet shows the code related to the “Tell a friend” option with id “SHARE_COMMAND” selected by the user.

src/main/res/menu/expenses.xml

    <item
106.    android:id="@id/SHARE_COMMAND"
        android:orderInCategory="30"
108.    android:title="@string/menu_share"
        app:showAsAction="never">
    </item>

Once the user has selected the current option the “dispatchCommand” method is called. Now from the previous file we know the menu item id, so in the following snippet at line 603, the action associated to the click event is defined, and as we can see from line 604 to 608 a new intent is created but a connection check is not made so at line 608 when the intent is send the app chooser is displayed.

src/main/java/org/totschnig/myexpenses/activity/MyExpenses.java

    public boolean dispatchCommand(int command, Object tag) {
    Intent i;
    TransactionList tl;
    switch (command) {
    ...
603.    case R.id.SHARE_COMMAND:
            i = new Intent();
            i.setAction(Intent.ACTION_SEND);
            i.putExtra(Intent.EXTRA_TEXT, Utils.getTellAFriendMessage(this));
            i.setType("text/plain");
608.        startActivity(Intent.createChooser(i, getResources().getText(R.string.menu_share)));
            return true;