An android library to create the new Android 7.1 shortcuts easily.
You can see all the library releases here.
Add this to your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Now add the dependency to your app build.gradle file:
compile 'com.github.marcoscgdev:shortcut-helper:1.0.3'
You can follow this snippet:
Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/marcoscgdev/shortcut-helper"));
Intent activityIntent = new Intent(Intent.ACTION_MAIN, Uri.EMPTY, this, ShortcutActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
ShortcutHelper.with(this)
.createShortcut(
"Short Label",
"Long Label",
R.drawable.ic_shortcut_android,
webIntent)
.createShortcut(
"Short Label 2",
"Long Label 2",
R.drawable.ic_shortcut_android,
activityIntent)
.go();
List<Shortcut> shortcutList = new ArrayList<Shortcut>();
shortcutList.add(new Shortcut("Short Label", "Long Label", R.drawable.ic_shortcut_android, activityIntent));
...
ShortcutHelper.with(this)
.createShortcutList(shortcutList)
.go();
See the sample project to clarify any queries you may have.
Copyright 2017 Marcos Calvo García
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.