You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2021. It is now read-only.
From the PendingIntent documentation (emphasis mine):
By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you build the PendingIntent: almost always, for example, the base Intent you supply should have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.
The current design has TransitionScheduler as an abstract class; in order to use the library, you subclass it and implement onAlarm(). This means we (the library authors) don't know the name of the subclass in order to specify it in the intent. To get around this, we find it at runtime with this.getClass():
Intent intent = new Intent(ACTION_ALARM, data, context, this.getClass());
The problem is, this.getClass() can't be used in a static context, so our schedule() and cancel() functions can't be static, either. It's not that big of a deal that we have to instantiate a TransitionScheduler in order to schedule, but it would be nice if we could just call TransitionScheduler.schedule().
Does anybody have ideas for how we might accomplish this, or should we just say what we have is good enough?
The text was updated successfully, but these errors were encountered:
From the PendingIntent documentation (emphasis mine):
The current design has
TransitionScheduler
as an abstract class; in order to use the library, you subclass it and implementonAlarm()
. This means we (the library authors) don't know the name of the subclass in order to specify it in the intent. To get around this, we find it at runtime withthis.getClass()
:The problem is,
this.getClass()
can't be used in a static context, so ourschedule()
andcancel()
functions can't be static, either. It's not that big of a deal that we have to instantiate aTransitionScheduler
in order to schedule, but it would be nice if we could just callTransitionScheduler.schedule()
.Does anybody have ideas for how we might accomplish this, or should we just say what we have is good enough?
The text was updated successfully, but these errors were encountered: