Code Monkey home page Code Monkey logo

Comments (6)

Ereza avatar Ereza commented on July 17, 2024

That would be cool!

There are some drawbacks however:

  • An app may have more than one activity with intent filter with category LAUNCHER.
  • An app may have NO launchable activity (for example, apps that are only widgets).

What should we do in those cases?

If you are willing to provide a proposal via pull request I can take a look at it.

Thanks!

from customactivityoncrash.

alorma avatar alorma commented on July 17, 2024

Maybe it can add a custom action in order to be launched from library:

        <activity
            android:name=".view.activity.ErrorActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme">
            <intent-filter>
                <action android:name="cat.ereza.customactivityoncrash.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

from customactivityoncrash.

alorma avatar alorma commented on July 17, 2024

Library should check for this action first, if there is no Activity with that, search for default android launcher activities, and if not launch the default library error Activity

from customactivityoncrash.

Ereza avatar Ereza commented on July 17, 2024

@alorma I think that's more complicated than the currently needed configuration... Anyway, we are talking about the activity that gets launched when pressing the "restart" button, so launching the error activity is independent from that.

IMHO, it should be like this:

  • If a restart activity has been specified with CustomActivityOnCrash.setRestartActivityClass(), use that.
  • If not specified, get the launchable activities via PackageManager, if one or more exist, just grab the first one by default (although I don't personally like that).
  • If no activities are launchable, just close the app.

Also, add an option to always close the app instead of restarting.

from customactivityoncrash.

alorma avatar alorma commented on July 17, 2024

Oh, sorry i missunderstood the Issue :D i will move it to a new Issue.

Anyway, it can be used in a similar way, with an extra action.

<action android:name="cat.ereza.customactivityoncrash.RELAUNCH" />

from customactivityoncrash.

Ereza avatar Ereza commented on July 17, 2024

Closed with the pull request #6 by @AizazAZ. Thanks!

from customactivityoncrash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.