nexxPLAY
Search…
android Widget

Basic Integration

Make the following changes to your Projects build.gradle
1
...
2
allprojects{
3
repositories{
4
maven { url "https://www.myget.org/F/3qnexx/maven" }
5
}
6
}
7
...
Copied!
add the following dependencies
1
dependencies {
2
implementation "tv.nexx.android:widget:2.0.01"
3
}
Copied!
Configure the Widget by adding the following Settings to your values/strings.xml:
1
<resources>
2
<string name="widget_domain" translatable="false">YOUR_DOMAIN_ID</string>
3
<string name="widget_feed_hash" translatable="false">YOUR_FEED_HASH</string>
4
<string name="widget_launchactivity" translatable="false">YOUR_LAUNCH_ACTIVITY</string>
5
6
<!-- only needed, if the Feed is secured with a Secret -->
7
<string name="widget_feed_secret" translatable="false">YOUR_FEED_SECRET</string>
8
<!-- this Parameter can be obtained from 3Q nexx or nexxOMNIA -->
9
<string name="widget_app" translatable="false">YOUR_APP_ID</string>
10
<!-- only needed for android 12+ -->
11
<string name="widget_description">Widget Description</string>
12
</resources>
Copied!
Handle the System Intents by adding a receiver to src/main/AndroidManifest.xml:
1
<receiver
2
android:name="tv.nexx.android.widget.Widget"
3
android:exported="true">
4
<intent-filter>
5
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
6
</intent-filter>
7
</receiver>
Copied!
Prepare the necessary Image Assets (Icon and Preview PNGs) and place them under src/main/res/drawable/
Asset
Dimensions
Usage
widget_icon.png
512x512px
Icon to be shown on the Widget as App Reference
widget_preview.png
660x400px
Icon for Widget Selection Dialogue in android

Enhanced Methods

It is possible to update/refresh/reconfigure all Widget Instances from your App directly with the following Methods:
1
import tv.nexx.android.widget.Widget;
2
import tv.nexx.android.widget.WidgetConfiguration;
3
4
public class MainActivity {
5
6
@Override
7
protected void onCreate(Bundle savedInstanceState) {
8
...
9
10
Widget widget = new Widget();
11
12
//simple force all Widget Instances to refresh the Feed
13
widget.updateWidgets(this.getContext());
14
15
//update the Configuration and refresh the Feed
16
WidgetConfiguration config=new WidgetConfiguration(
17
new HashMap<String, Object>() {{
18
put("language","es");
19
put("feedUpdateInterval", 30);
20
}}
21
);
22
widget.updateConfiguration(this.getContext(),config);
23
}
24
}
Copied!
For a detailed Overview of the Meaning of the given Configuration, please take a look here:
Last modified 14d ago