Skip to content

Commit

Permalink
Add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Jun 24, 2017
1 parent 2881f15 commit ce37589
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img src="https://raw.githubusercontent.com/pranavpandey/dynamic-engine/master/graphics/dynamic-engine_512x512.png" width="160" height="160" align="right" hspace="20">

# Dynamic Engine

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?)](https://www.apache.org/licenses/LICENSE-2.0.html)
Expand Down Expand Up @@ -26,18 +28,6 @@ foreground app via service on Android 9+ (Gingerbread or above) devices.
It can be installed by adding the following dependency to your `build.gradle` file:

```groovy
allprojects {
repositories {
...
maven {
url 'https://dl.bintray.com/pranavpandey/android/'
}
}
}
...
dependencies {
compile 'com.pranavpandey.android:dynamic-engine:0.1.0'
}
Expand All @@ -56,6 +46,11 @@ events. I will do my best to add more tasks later.
Extend the `DynamicEngine` service and implement the interface functions to monitor monitor
call, lock, headset, charging and dock related events.

On Android M (Marshmallow) or above devices, `READ_PHONE_STATE` permission must be granted for
the app `package` to monitor call events. If this permission is not granted then,
`onCallStateChange(isCall)` method will never be called. For more information on the
`runtime permissions`, please read official documentation [here](https://developer.android.com/training/permissions/requesting.html).

```java
public class MonitorService extends DynamicEngine {

Expand All @@ -81,7 +76,8 @@ public class MonitorService extends DynamicEngine {
*
* @param isCall {@code true} if the device is on call. Either ringing
* or answered.
*/ @Override
*/
@Override
public void onCallStateChange(isCall) {

}
Expand Down Expand Up @@ -144,6 +140,11 @@ currently in `beta` stage so, more improvements will be done in the future.
It will not run by default to save resources. It should be started explicitly by calling the
`setAppMonitor(isRunning)`.

On Android L (Lollipop) or above devices, `PACKAGE_USAGE_STATS` permission must be granted for
the app `package` to monitor foreground app. If this permission is not granted then,
`onAppChange(dynamicAppInfo)` method will never be called. For more information on the
`UsageStatsManager`, please read official documentation [here](https://developer.android.com/reference/android/app/usage/UsageStatsManager.html).

```java
public class MonitorService extends DynamicEngine {

Expand All @@ -160,6 +161,17 @@ public class MonitorService extends DynamicEngine {
setAppMonitor(isRunning);

...

/**
* On foreground app changed. Use it to provide the app specific
* functionality in the app.
*
* @param dynamicAppInfo {@link DynamicAppInfo} of the foreground package.
*/
@override
public void onAppChange(dynamicAppInfo);

...
}
````

Expand Down
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ allprojects {
maven {
url "https://maven.google.com"
}

maven {
url 'https://dl.bintray.com/pranavpandey/android/'
}
}
}

Expand Down
Binary file added graphics/dynamic-engine.psd
Binary file not shown.
Binary file added graphics/dynamic-engine_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ce37589

Please sign in to comment.